I created this program to check if the user inputs a number. When they input a number, the program runs smoothly. However, when a user does not input a number, the program repeatedly posts "Invalid. Enter a Decimal number please," and does not allow for the loop to repeat until a number is inputted. How can I modify this?
def validate_number(user_input):
while True:
try:
user_input = int(user_input)
break
except ValueError:
print()
print("Invaild. Enter a decimal number please.")
budget = input('What is your budget: $')
validate_number(budget)
plane_tickets = input("How much are the plane tickets in USD: $")
validate_number(plane_tickets)
hotel = input("How much is the hotel in USD: $")
validate_number(hotel)