hello,
i am really getting mad with these few lines of code
could you explain what i am doing wrong?
i am really getting mad with these few lines of code
from random import randint header = ["test", "1", "2", "12", "GG", "NG"] lis = ["alpha", "beta", "gamma"] list_p = list() dict_p = dict.fromkeys(header) def random(): for item in lis: dict_p["test"] = item for key in list(dict_p.keys())[1:]: dict_p[key] = randint(1,600)/100.0 list_p.append(dict_p) return list_p print(random())i know from here that Changing One dict value changes all values in a list and even if i feel completely dumb i am not able to apply these answers to my case
could you explain what i am doing wrong?
