Comment me answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Comment me answer

How to make a input number into even in python

10th Oct 2022, 11:20 AM
L364CY
L364CY - avatar
3 Answers
+ 6
Bikesh Sah , please make a sample with different input numbers, and what you expect as an output. what numbers do you expect to get from input: > inter number > float number > can input numbers also be negative?
10th Oct 2022, 3:34 PM
Lothar
Lothar - avatar
+ 3
You could divide by 2, round or make it an integer, the multiply by 2. The double of any number will always be even. int(num/2)*2 or floor(num/2)*2 or ceil(num/2)*2
10th Oct 2022, 1:55 PM
Lisa
Lisa - avatar
+ 1
x = int(input()) , and pls search on google before asking try hard!
10th Oct 2022, 11:22 AM
Mahmmoud Khalid
Mahmmoud Khalid - avatar