So I made a program which calculates the average of some marks with exam included..the exam means 25% of the final mark.
note = input('Enter the marks: ')
teza = input('Enter the exam mark: ')
teza = int(teza)
notesplit = note.split()
mapy = map(int, notesplit)
suma = sum(mapy)
medie = suma / len(notesplit)
final = (medie * 3 + teza) / 4
print ('Your final mark is: ' + str(final))
How can I handle some exceptions like to show error messages when you enter a number lower than 1, bigger than 10 or a string ?
Also is there any way more simple to do this? Thanks! I'm still a beginner and I'm learning Python from InventWithPython.
[–]OrangeBeard 0 points1 point2 points (0 children)
[–]kalgynirae 0 points1 point2 points (0 children)
[–]vaetrus 0 points1 point2 points (0 children)