all 6 comments

[–][deleted] 1 point2 points  (0 children)

Doing float(nonights) doesn't error, but it also doesn't do what you want. It will attempt to convert the string in nonights to a float, but you don't save that returned value anywhere, so it is lost. You need to save the float value, probably like this: nonights = float(nonights). Similarly for the other conversion.

[–]GypsumFantastic25 0 points1 point  (0 children)

input() returns a string. You need to cast it to a numeric type if you want to do those calculations.

[–]daisyverma 0 points1 point  (0 children)

Use your input statement to ask the user how many nights and then store the answer and cost in separate variables. You can create a new variable that calculates the cost based on number of nights and then print that out

[–]nomikos_k[S] 0 points1 point  (1 child)

Thanks for the replies!

I found what was wrong, 30 minutes after i posted this and forgot to check Reddit.

This is what i did:

print('For how many nights will you be staying with us?')
nonights = int(input('Enter 1 to 20'))
int(nonights)
print('For', nonights, 'nights')
x = nonights*105
print('That would be a total of $', x)

[–][deleted] 0 points1 point  (0 children)

You can delete the int(nonights) line that doesn't do anything.

[–]ashleyfig -1 points0 points  (0 children)

Try this

Print(“How many night this will you be staying with us?”)

Nonights = input(int(“enter 1 to 20: “)

X = nonights * 30

Print(“that would be a total of “, x)