How to solve this problem of 'if statement' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to solve this problem of 'if statement'

The result I want to get in python screen is that If a score (using 'raw_input operator) is between 0.0 and 1.0 , it print out 'A ' Otherwise print out 'Error.' Ex) Enter score: 0.95 A Enter score: 10.0 Error Please help me out I have been solving problems on Textbook (author is Dr.Chuck.)

24th Jul 2016, 3:55 PM
shin eun kyung
shin eun kyung - avatar
2 Answers
+ 1
try to convert your 'score' to float instead of an integer. score = float(raw_input()) if (score <1) and (0< score): print 'A' else: print 'error'
24th Jul 2016, 4:52 PM
Guille
0
Thank you :)
24th Jul 2016, 11:15 PM
shin eun kyung
shin eun kyung - avatar