Question

In: Computer Science

This task is solved in Python 3. Develop a program that can, among other things, manage...

This task is solved in Python 3.

Develop a program that can, among other things, manage your courses and course results.

It must also be able to calculate the average grade, for all grades or for a selection of grades

limited to a certain subject area and / or course level (100, 200 or 300 level).

NB! All courses are worth the same amount of credits.

The program should have two global collections

  • Courses is a list that contains the courses you have taken or plan to take.

All courses belong to a subject area and have a course code that starts with at least three letters and always ends with three digits, of which the first digit is 1, 2 or 3 which indicates the level of the course.

  • Grades are a list of course results. For example

Grades = {"INFO100": "C", "INFO104": "B", "ECON100": "B",…}

(All courses registered in Grades must be found in Courses, but not necessarily vice versa.)

The program should let the user select action from a menu and continue until the user chooses to exit.

The purpose of the program is for you to be able to calculate your grade points, in total and for granted subject areas and / or levels. In addition, you should be able to add new courses and set / change grades temporarily so you can experiment with how improved and upcoming results will give an effect on the grade point average.

Try to make the program robust for errors on the part of the user, such as entering a rating in form of a number, or a letter outside A-F.

On the next page you will find a guiding example of what the dialogue can look like:

>>> start ()

--------------------

1 Course list

2 Add course

3 Grade

4 Grade point average

5 Exit

--------------------

Choose action (0 for menu)> 1

Choose course and / or course level (<enter> for all)

- Course:

- Level:

INFO100 C

INFO104 B

INFO125 B

INFO132 A

INFO180

INFO216 A

INFO282 C

INFO284

ECON100 C

ECON110 C

ECON218

GE0100

GEO113 D

GEO124 D

Choose action (0 for menu)> 2

New course: ECON221

Choose action (0 for menu)> 1

Choose course and / or course level (<enter> for all)

- Course: Economics

- Level: 200

ECON218

ECON221

Choose action (0 for menu)> 3

Course: INFO284

Grade (<enter> to delete): B

Choose action (0 for menu)> 4

Choose course and / or course level (<enter> for all)

- Course: Information science

- Level: 100

Average: B

Choose action (0 for menu)> 4

Choose course and / or course level (<enter> for all)

- Course:

- Level:

Average: C

Choose action (0 for menu)> 0

--------------------

1 Course list

2 Add course

3 Grades

4 Grade point average

5 Exit

--------------------

Choose action (0 for menu)> 3

Course: GEO124

Grade (<enter> to delete): A

Choose action (0 for menu)> 4

Choose course and / or course level (<enter> for all)

- Course:

- Level:

Grade point average: B

Select action (0 for menu)> 5

Thanks for now

>>>

Solutions

Expert Solution

Courses = []
Grades = {}

def menu():
print('1 Course list')
print('2 Add course')
print('3 Grade')
print('4 Grade point average')
print('5 Exit')
  
def view():
print('Choose course and/or course level(<enter> for all)')
course = input('- Course: ')
level = input('- Level: ')
flag = False
for i in Courses:
if course == '' or course[:3].upper() in i:
if not level or level[0] == i[-3]:
grade = Grades.get(i)
if not grade:
grade = ''
flag = True
print(i,grade)
if not flag:
print('Course not found')

def add():
while True:
course = input("New course: ")
if len(course)>=6:
code = course[:-3]
if course[-3:].isdigit() and len(code)>=3:
if code.isalpha() and code.isupper():
break
print('Please enter a valid course')
Courses.append(course)

def grade():
course = input("Course: ")
grade = input('Grade (<enter> to delete): ')
if grade:
if course in Courses:
Grades[course] = grade
else:
print("Please add course first")
else:
try:
del Grades[course]
except:
print('Already unassigned')

def average():
print('Choose course and/or course level(<enter> for all)')
course = input('- Course: ')
level = input('- Level: ')
selection = []
for i in Courses:
if course == '' or course[:3].upper() in i:
if not level or level[0] == i[-3]:
grade = Grades.get(i)
if grade:
k = 'FEDCBA'.index(grade)
selection.append(k*16.67)
if selection:
avg = sum(selection)/len(selection)
grade = 'FEDCBA'[round(avg/16.67)]
print("Average:",grade)
else:
print("Grades not assigned")
  
def start():
menu()
while True:
try:
ch = int(input('Choose action (0 for menu)> '))
except:
print('Invalid input. Please enter number from 0-5')
continue
if ch==0:
menu()
elif ch==1:
view()
elif ch==2:
add()
elif ch==3:
grade()
elif ch==4:
average()
elif ch==5:
print('Thanks for now')
break
else:
print('Please enter number from 0-5')


Related Solutions

This task is solved in Python 3. Develop a program that can change the phone number...
This task is solved in Python 3. Develop a program that can change the phone number of a person in phone.txt (hint: the easiest thing is probably to make a new version of the file, and then delete the old one before the new is renamed to phone.txt) Name: John Old phone number: 99776612 New number: 99889999 >>> phone.txt Replaced by ------> phone.txt Mary 98654321 June 99776655 Chris 99112233 Viv 98554455 John 99776612 Joe 97888776 Rick 99455443 Susan 98122134 Jill...
This task is solved in Python 3. Develop a program that lets the user add new...
This task is solved in Python 3. Develop a program that lets the user add new people to the file phone.txt Add name and number, end with <enter> Name and number: Robin 94567402 Name and number: Jessica 99468283 Name and number: >>> Phone.txt Expanded to ------> Phone.txt Mary 98654321 June 99776655 Chris 99112233 Viv 98554455 John 99776612 Joe 97888776 Rick 99455443 Susan 98122134 Jill 99655732 Bob 98787896 Mary 98654321 June 99776655 Chris 99112233 Viv 98554455 John 99776612 Joe 97888776 Rick...
This task is solved in Python 3. Develop a function which counts the number of vowels...
This task is solved in Python 3. Develop a function which counts the number of vowels in a text. >>> numberofVowels ("There is a cat outside the house") 13
MUST BE PYTHON 3 Instructions: The following programming problem can be solved by a program that...
MUST BE PYTHON 3 Instructions: The following programming problem can be solved by a program that performs three basic tasks (Input Data, Process Data, Output Results) along with selection and repetition coding techniques. Problem Statement A finance company provides loans for motorcycles at different rates depending on how much the total loan amount is and how many payments will be made on the loan. Using the information in the table below, write a program that will calculate the monthly payment...
This task is about classes and objects, and is solved in Python 3. We will look...
This task is about classes and objects, and is solved in Python 3. We will look at two different ways to represent a succession of monarchs, e.g. the series of Norwegian kings from Haakon VII to Harald V, and print it out like this: King Haakon VII of Norway, accession: 1905 King Olav V of Norway, accession: 1957 King Harald V of Norway, accession: 1991 >>> Make a class Monarch with three attributes: the name of the monarch, the nation...
Among other things, faulty cost information can have an impact on inventory valuation (if it is...
Among other things, faulty cost information can have an impact on inventory valuation (if it is a manufacturing or retail business) and/or pricing of goods and services. When you calculate your product's cost incorrectly, you end up pricing it incorrectly, and in the long run it can affect your market. Last week we discussed cost containment, cost management, cost reduction, etc. In order to contain, manage or reduce costs, it is important to first gather and record costs as accurately...
Write a Python program to manage league matches. Different teams can participate in a league. A...
Write a Python program to manage league matches. Different teams can participate in a league. A player belongs to a team and a team can play many games in a league. For each team, the league wants to track the name of the team and the number of players in each team. The league also wants to track the number of games the team has played, and the total numbers of points scored across all games played. During each game,...
IN PYTHON Develop a program in python that includes a number of functions for the multi-server...
IN PYTHON Develop a program in python that includes a number of functions for the multi-server queue. The program accepts arrival and services rates and the number of servers and calls your functions to output the average number of customers and average waiting time in the system.
Describe a task that can be solved using constraints. Distinguish between the hard constraints and the...
Describe a task that can be solved using constraints. Distinguish between the hard constraints and the soft constraints of the system. Develop a model of the constraint based solution using a table or a diagram.
LOOK over code Python The task aims to develop a Kalman filter that is able to...
LOOK over code Python The task aims to develop a Kalman filter that is able to hit the moving target (the pink box) in as many situations as possible. However, there are some limitations: IT IS NOT PERMITTED TO CHANGE THE PRODEIL AND TARGET CODE IT IS ALSO NOT ALLOWED TO CHANGE THE GAME LOOP, OTHER THAN WHAT HAS BEEN COMMENTS SHALL BE CHANGED WHEN THE Kalman CLASS IS IMPLEMENTED I have made the callman class, but my question is;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT