Reputation: 21
Hi, I just started learning computer science and am stuck. My program stops running after the user inputs where they would like to go on vacation. I can't seem to find any errors as to why the program ends after the line," location = input("Where would you like to go on vacation?") ". I copy and pasted the program below.
print("Congratulations, you have won a free vacation with airfare and hotel expenses paid!")
input("What is your name?")
location = input("Where would you like to go on vacation?")
print(location)
num_days = input("How many days will you spend on vacation, 4 or 7?")
expenses = num_days*100
print("The total expenses for food and entertainment will be" + expenses)
Upvotes: 1
Views: 84
Reputation: 1145
We don't see any error in your code. Please double check your code.
Additionally, keep in mind that input()
returns string
by default. You have to convert it to integer
using int()
to use it in arithmetic operations like addition,multiplication. Similarly, str()
is used to convert an integer to string.
So, the last three lines need to be like this
num_days = int(input("How many days will you spend on vacation, 4 or 7?"))
expenses = num_days*100
print("The total expenses for food and entertainment will be" + str(expenses))
Upvotes: 1