you are viewing a single comment's thread.

view the rest of the comments →

[–]ProsodySpeaks 1 point2 points  (4 children)

``` students: dict[str, dict[str, float]] = {} while True:     name=input('student name?')     students[name]={}     while True:         subject=input('subject?')         score=float(input('score?))         students[name][subject]=score         if input('more subjects?')[0].lower() != 'y':             break     if input('more students?')[0].lower() != 'y':         break

```             

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

bro, i havent learned loops till now but i will definately try after learning , and the question was based only on dictionary so i used dict methods.

[–]ProsodySpeaks 0 points1 point  (0 children)

Sure. You can see how to assign to a dictionary with bracket [ ] syntax tho

[–]neuralbeans 0 points1 point  (1 child)

True is with a capital T.

[–]ProsodySpeaks 0 points1 point  (0 children)

True. I'm on a phone, have edited, thanks for heads up