Exam4B.pdf +v EXAMO4B 1. Write a program that repeatedly prompts the user for th
ID: 3891250 • Letter: E
Question
Exam4B.pdf +v EXAMO4B 1. Write a program that repeatedly prompts the user for the testi, test2 as well as the semester (Spring, Summer, Fall) and for output displays the numerical or letter rade or both based upon the choice of the user. Calculate the numerical grade as ollows: If Spring grade (test1 2+test2) /3 If Summer grade (testl+test2)/2 If Fall grade (Test1+test2 2) /3 Make sure to write the problem in a void method called gradeProblem) Keep the problem repeating using a menu. 30Pts Grade Menu ical Grade 2. Letter Grade 3. Both . Exit Choice:3 Enter Testl: 100 er ?@st2 : 80 rical Grade: 90 Letter Grade: A Menu 1. Numerical Grade 2. Letter Grade . Both 4. Exit for using thisExplanation / Answer
Hello,
Here is the code for the above problem in python3.
print('Grade Menu')
print('1.Numerical Grade')
print('2.Letter Grade')
print('3.Both')
print('4.Exit')
print('Choice:')
a=int(input())
if(a==1):
print('Enter Test1:')
t1=int(input())
print('Enter Test2:')
t2=int(input())
print('semester')
sem=str(input())
if(sem=='spring'):
print('Numerical Grade:'+str(((t1*2)+t2)//3))
if(sem=='summer'):
print('Numerical Grade:'+str((t1+t2)//2))
if(sem=='fall'):
print('Numerical Grade'+str((t1+t2*2)//3))
if(a==3):
print('Enter Test1:')
t1=int(input())
print('Enter Test2:')
t2=int(input())
print('semester')
sem=str(input())
if(sem=='spring'):
print('Numerical Grade:'+str(((t1*2)+t2)//3))
if(((t1*2)+t2)//3)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
if(sem=='summer'):
print('Numerical Grade:'+str((t1+t2)//2))
if((t1+t2)//2)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
if(sem=='fall'):
if((t1+t2*2)//3)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
print('Numerical Grade'+str((t1+t2*2)//3))
if(a==2):
print('Enter Test1:')
t1=int(input())
print('Enter Test2:')
t2=int(input())
print('semester')
sem=str(input())
if(sem=='spring'):
if(((t1*2)+t2)//3)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
if(sem=='summer'):
if((t1+t2)//2)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
if(sem=='fall'):
if((t1+t2*2)//3)>=90:
print('Letter Grade:A')
else:
print('Letter Grade:B')
if(a==4):
print('Thank you for using')
I tested the above code it is working fine. If you need to do any change you can absolutely make them.
Hope, I have solved your problem :)
Thank you :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.