Help me!!! It's very difficult the exersice 20.5, please of python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me!!! It's very difficult the exersice 20.5, please of python.

This is my code: number = input() if number == "1": print (int(number)*3) elif number == "2": print (int(number)*2) elif number == "0": print (int(number)*0) else: print (int(number)*3)

16th Jan 2022, 4:08 PM
Jefferson Jesus Beleño Suarez
Jefferson Jesus Beleño Suarez - avatar
5 Answers
+ 3
Krishni okay, sorry, if my comment confused you!
16th Jan 2022, 4:31 PM
Lisa
Lisa - avatar
+ 2
You only check the numbers 1 and 2 – but you need to test if the input is odd or even.
16th Jan 2022, 4:20 PM
Lisa
Lisa - avatar
+ 2
Wow! Thank you very much Krishni
16th Jan 2022, 4:25 PM
Jefferson Jesus Beleño Suarez
Jefferson Jesus Beleño Suarez - avatar
0
Krishni my comment is a reply to the OP's question
16th Jan 2022, 4:25 PM
Lisa
Lisa - avatar
0
You can convert the user input to integer
17th Jan 2022, 2:26 PM
Ibrahim Habibu
Ibrahim Habibu - avatar