Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a program named program 61.py This program will have three functions, the main() create() and retrieve(). main() will call create() and then call

image text in transcribed

1. Write a program named program 61.py This program will have three functions, the main() create() and retrieve(). main() will call create() and then call retrieve() create() will prompt the user to enter any number of course name / grade pairs and write them to a file named grades.txt. 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() retrieve() will open and read grades.txt. The function then will print the course names and scores as shown below. The average score should be calculated and displayed to two decimal places and then return variable used for the average to the main(). See sample run below in which 4 course names were entered, but note that more or fewer courses could have been entered. Enter course name or Enter to quit: COP1000 Enter grade (integer) achieved: 85 Enter course name or Enter to quit: CGS1100 Enter grade (integer) achieved: 92 Enter course name or Enter to quit: PHY2040 Enter grade (integer) achieved: 76 Enter course name or Enter to quit: MAT 2240 Enter grade (integer) achieved: 84 Enter course name or Enter to quit: File was created and closed Here are your grades: COP1000 score is 85 CGS1100 Score is 92 PHY2040 score is 76 MAT2240 score is 84 Average grade among your courses is 84.25 Be sure to recheck the requirements before you submit this assignment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions