Вот модифицированный код, пожалуйста, проверьте, я прокомментировал несколько строк, а также использовал некоторые переменные, которые я видел в вашем коде, чтобы он работал в моей системе.
def bagTotal():
# The below 4 initializations are just
# to stop errors in your problem, you use your own values
bagFee = 100
ticketamount = 60
name = 'Rampel Jons'
ticket = 70
while True:
try:
bagCount = int(input("Now we just need the number of bags you wish to take with you: "))
if (bagCount <= 2):
print("As stated before the first bag is free")
print(name,",your total is","$%>2F"%ticket)
print("")
print("")
restart()
else:
bagTotal = (bagCount - 1) * bagFee
ticketTotal = bagTotal + ticketamount
print(name,", your new total is","$%.2f"%ticketTotal)
print("")
print("")
restart()
except ValueError:
print("Please input a number")
print("")
# call
bagTotal()
# Now we just need the number of bags you wish to take with you: 5
# Rampel Jons , your new total is $460.00
# Now we just need the number of bags you wish to take with you: 7
# Rampel Jons , your new total is $660.00
# Now we just need the number of bags you wish to take with you: 9
# Rampel Jons , your new total is $860.00
# Now we just need the number of bags you wish to take with you: fjjfjf
# Please input a number
# Now we just need the number of bags you wish to take with you: