Build a Report Card
Python
15 pts
Build a Report Card
Start with this list:
subjects = ["math", "english", "science"]
- Create
markswithdict.fromkeys()so that every subject starts at0. - Use
update()to set math to85and science to78. - Use
setdefault()to add"art"with the value60. - Print
marks. - Print the value of
"history"usingget()with the default"not taken".
Expected output:
{'math': 85, 'english': 0, 'science': 78, 'art': 60}
not taken
Checklist
- Create
marksfromsubjects, with every subject starting at 0. - Set the math and science marks with
update(). - Add
"art"withsetdefault(). - Print
marks, then the history mark with a default.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
