Help me!!! It's very difficult the exersice 20.5, please of python. | Sololearn: Learn to code for FREE!

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)

1/16/2022 4:08:55 PM

Jefferson Jesus Beleño Suarez

+4

Jefferson Jesus Beleño Suarez number = int(input()) if number%2==0: print (number*2) elif number%2==1: print (number*3) else: print (0) You need to use int(input())

+3

Krishni okay, sorry, if my comment confused you!

+2

You only check the numbers 1 and 2 – but you need to test if the input is odd or even.

+2

Wow! Thank you very much Krishni

+1

Lisa By finding the reminder when divided by 2, we can come to know if the input is odd or even

+1

Lisa ok But I thought it was a question 😅

0

Krishni my comment is a reply to the OP's question

0

You can convert the user input to integer