Write a program named program61.py This program will have three functions, the main() create() and retrieve(). main() will call: create() and main() then calls retrieve() create() will prompt the user to enter any number of course name | grade values. The course name ,AND calculated class GPA ( not the class grade ) are the written one value per line to a file named grades.txt ( review example of grades.txt below! ). Pressing Enter with no input value on the course name will exit the loop, close the file, print "File was created and closed" and return the bool value True to the main(). See Simple GPA Tip below. retrieve() will open and read grades.txt. The function then will print the course names and Class GPA as shown below. The average of all class GPA values should be calculated and displayed to two decimal places and then return variable used for the GPA average to the main() . See sample run below in which 2 course names were entered, but note that more or fewer courses could have been entered. Also shown is what the contents of the grades.txt file would look like.
1. Write a program named program61.py
This program will have three functions, the main() create() and retrieve().
main() will call: create() and main() then calls retrieve()
create() will prompt the user to enter any number of course name | grade values. The course name ,AND calculated class GPA ( not the class grade ) are the written one value per line to a file named grades.txt ( review example of grades.txt below! ). Pressing Enter with no input value on the course name will exit the loop, close the file, print "File was created and closed" and return the bool value True to the main(). See Simple GPA Tip below.
retrieve() will open and read grades.txt. The function then will print the course names and Class GPA as shown below. The average of all class GPA values should be calculated and displayed to two decimal places and then return variable used for the GPA average to the main() . See sample run below in which 2 course names were entered, but note that more or fewer courses could have been entered. Also shown is what the contents of the grades.txt file would look like.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images