Challenge: Write a code that doubles the number each time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Challenge: Write a code that doubles the number each time

This appears really simple but I haven’t been able to work out how to do it... I’ve tried every approach I could think of. Maybe i’m just being stupid? Code should output: 1 2 4 8 16 32 64 128 256 ...

16th Jun 2018, 4:16 PM
Jack
Jack - avatar
3 Answers
16th Jun 2018, 4:24 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
it doesnt double the number, it squares the number, maybe thats why u get it wrong
16th Jun 2018, 4:40 PM
ghali lawal
ghali lawal - avatar
+ 1
x=1 for x<512 x*2 print(x)
17th Jun 2018, 11:04 PM
mYstic
mYstic - avatar