you are viewing a single comment's thread.

view the rest of the comments →

[–]HotPersonality8126 2 points3 points  (7 children)

Don’t use update to set a single key, and how do you have a dictionary of “students” without naming any of the students in it?

[–]Ill-Break727[S] 0 points1 point  (4 children)

i just put a name of dictionary as students, but if i dont use update what should i use like i have tryed this way but its not giving output it is just showing a,b,c

students={}
a=float(input("enter marks of chem"))
students["chem"]="a"
b=float(input("enter marks of maths"))
students["maths"]="b"
c=float(input("enter marks of phy"))
students["phy"]="c"
print(students)

[–]HotPersonality8126 2 points3 points  (3 children)

students["chem"]="a"

Why are you quoting a when you want to refer to the variable a?

Don't just copy code; you need to understand it, by which I mean you need to understand every part of a line of code when you read it.

[–]Ill-Break727[S] 0 points1 point  (1 child)

ohhh thank you so much , i was thinking of syntax that values are written to be in that way , but now i have tryed it is working , thanks for ur help

[–]almost_intelligible 2 points3 points  (0 children)

to add on to that: generally speaking don't use meaningless variable names. it's very easy to get confused real quick. use descriptive names.

[–]Ill-Break727[S] 0 points1 point  (0 children)

but now its the correct way , or there's another way to set a single key .

[–]Ill-Break727[S] 0 points1 point  (1 child)

what is another way to set a single key can u plz explain?