+ 6

PYTHON ELIF PRACTICE DIFFICULTIES

I was trying the pro side practice feature and got stuck on a problem the practice was to make a program that would take a number as input and output the twice of number if it is a even number and output thrice the number if the number was even and it would output 0 if the number was zero. I made the program it ran successfully but showed error in the task 5 part other all went good please help me with this. Here’s the link to the problem https://sololearn.com/coach/133/?ref=app

3rd Jan 2021, 5:33 PM
Harnoor Singh
Harnoor Singh - avatar
7 Antworten
+ 5
# my attempt to solve this number = int(input()) #your code goes here if number == 0: print("0") elif number%2 == 0: print(number*2) else: print(number*3)
3rd Jan 2021, 5:46 PM
Martin Ed
Martin Ed - avatar
+ 5
please give me link of that code coach i will try to help you.
3rd Jan 2021, 5:40 PM
RTK-AMAN
+ 2
thank you Martin Ed for helping me out
3rd Jan 2021, 5:50 PM
Harnoor Singh
Harnoor Singh - avatar
+ 1
number = int(input()) #your code goes here if number == 0: print(number) elif number%2 == 0 and number != 0: print(number*2) else: print(number*3)
3rd Jan 2021, 9:22 PM
Shadoff
Shadoff - avatar
3rd Jan 2021, 5:44 PM
Harnoor Singh
Harnoor Singh - avatar
0
4
4th Jan 2021, 8:38 PM
Margaret Yeboaa
0
wow great answer
5th Jan 2021, 12:37 AM
Sam Ahmed
Sam Ahmed - avatar