Home > other >  Python self-study for help
Python self-study for help

Time:09-30

Prompt="What is your age? "
Message=input (prompt)
If message<='3' :
Print (' You are free ')
Elif message<:='12'
Print (' 10 dollars')
The else:
Print (' 15 dollars')


Enter 3 or below, ok, input more than 3 direct tip 15 dollars,
Elif added conditions, isn't it? Why can't input between 4 to 12 tips for 10 dollars?
Thanks a lot!

CodePudding user response:

You now is the comparison of the string, so there is a problem, suggest to switch the input integer to compare
 
Prompt="What is your age? "
Message=int (input (prompt))
If message<=3:
Print (' You are free ')
Elif message<=12:
Print (' 10 dollars')
The else:
Print (' 15 dollars')

CodePudding user response:

Thanks a lot, yes, int later with respect to ok,

CodePudding user response:

Compare the wrong direction
  • Related