+ 2

Not understanding what is being asked?

Write a program that takes a number as input and - returns its double, if the number is even - returns its triple, if the number is odd - returns 0, if number is 0 Sample Input: 1 Sample Output: 3 Hint: An integer is even if it is divisible by two and odd if it is not even. Does anyone know how this problem should be split into solvable steps? Thank you

18th Nov 2020, 6:17 PM
Alex
10 ответов
+ 7
Hello! I solved by telling him it's an integer. You have to put int before number. Like this: number = input() #your code goes here if int(number)%2==0: print(int(number)*2) elif not int(number)%2==0: print(int(number)*3) elif int(number)==0: print(number)
16th Apr 2021, 11:00 AM
Simone Bucci
Simone Bucci - avatar
0
Thats what I wrote: number = int(input()) #your code goes here if number // 2: print(number + number) elif not number // 2: print(number + number + number) elif num == 0: print(num) But the 4th is still failing. Can someone please help me. Thank you!
27th Jan 2021, 2:13 PM
Andreas
Andreas - avatar
0
number = input() #your code goes here if int(number) % 2 == 0: print(int(number) * 2) elif int(number) != 0: print(int(number) * 3) elif int(number)==0: print(number)
29th May 2021, 6:59 AM
Jaszka
Jaszka - avatar
0
Here is another option: number = int(input()) if number % 2 == 0: print(number * 2) elif number % 2 == 1: print(number * 3)
16th Jun 2021, 4:05 AM
Harry
Harry - avatar
0
if number % 2 == 0: print(number * 2) elif number % 2 != 0: print(number * 3) elif number == 0: print(number)
2nd Sep 2021, 5:03 PM
Lourdes Badaracco
0
number = int(input()) #your code goes here if (number % 2 == 0): print (number * 2) elif (number % 1 == 0): print (number *3) elif (number == 0): print ("0")
30th Sep 2021, 7:37 AM
Matt Webb
0
number = input() if int(number) % 2 == 0: print(int(number) * 2) elif int(number) % 2 != 0: print(int(number) * 3) elif int(number) == 0: print(int(number))
9th Nov 2021, 2:35 PM
Ak_ Lock
Ak_ Lock - avatar
0
number = int(input()) if number % 2 == 0: print(number*2) elif number % 1 == 0: print(number*3) else: print(0)
8th Jan 2022, 1:15 PM
Ihor Princ
Ihor Princ - avatar