Grades in a List and a File¶

Prompt the user for a first and last name, and the name for a file. Randomly choose five grades for that person from 1 to 100 and store them in a list. Then output the first and last name and those five grades to the specified file.

Name your program grades_file.py

Name (first last): Marc Antony
Filename: marks.txt

Here are your randomly-selected grades (hope you pass):
Grade 1: 54
Grade 2: 90
Grade 3: 18
Grade 4: 37
Grade 5: 62

Data saved in "marks.txt".

Later, if you look in marks.txt (or whatever you called your file), you should see values like this:

Marc Antony
54 90 18 37 62

©2021 Daniel Gallo

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Creative Commons License

Adapted for Python from Graham Mitchell’s Programming By Doing