Query


#1

def hotel_cost(nights):
"""hotel cost is 140 per night"""
return 140*nights
n = raw_input("how many nights you are staying:")
print hotel_cost(n)

what is the wrong in this code?


#2

For the lesson you don't need to ask the user for input.

Also when you use raw_input() it safes the input as a string. That means if you run your programm and the input is 5, n will equal "5" not 5 like you want it to. You can convert a string to a number with int() for a whole number or float() for a decimal.

n = "5"
print n == 5
#prints False

n = int("5")
print n == 5
#prints True