How to make 6 18 and 6 instead of 33 99 and 33 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make 6 18 and 6 instead of 33 99 and 33

x = input('Enter a number from 2 to 10 : ') print(x) y = abs(int(x + x)) print(y) t = abs(int(y * 3)) print(t) f = abs(int(float(t) / float(x))) print(f) OUTPUT Enter a number from 2 to 10 : 3 33 99 33

31st Dec 2016, 11:35 AM
Лилия Устинова
Лилия Устинова - avatar
1 Answer
+ 1
Try converting to integer BEFORE the sum. Your x + x is concatenating strings, instead of summing numbers.
31st Dec 2016, 11:46 AM
Dao
Dao - avatar