Create 4 Variables use input function() (Name (string), Math Grade (float), Science Grade (float), English Grade (integer), Average (float)). Use input statement and display the result:
Name=input('Enter the name: ')
while True:
try:
Math_Grade=float(input('Enter a Math grade: '))
break
except:
print('You can only enter a numbers.')
while True:
try:
Science_Grade=float(input('Enter a Science grade: '))
break
except:
print('You can only enter a numbers.')
while True:
try:
English_Grade=int(input('Enter a English grade: '))
break
except:
print('You can only enter a integer.')
Average=(Math_Grade+Science_Grade+English_Grade)/3
print('Average score of {} is {:.2f}'.format(Name, Average))
Comments
Leave a comment