Basic task of making code that can find the sum & average of 10 numbers from the user.
My current situation so far:
Sum = 0
print("Please Enter 10 Numbers\n")
for i in range (1,11):
num = int(input("Number %d =" %i))
sum = Sum + num
avg = Sum / 10
However, I want to make it so that if the user inputs an answer such as "Number 2 = 1sd" it doesn't stop the code immediately. Instead I'm looking for it to respond as "Invalid input. Try again" and then it restarts from the failed input.
e.g.
"Number 2 = 1sd"
"Invalid input. Try again."
"Number 2 = ..."
How would I achieve that?