Help me guys.. I'm just messed up with this question.. My wrong answer is 16 😒..what's yours.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me guys.. I'm just messed up with this question.. My wrong answer is 16 😒..what's yours..

How many letters 'a' will be printed after this code is executed? i = 0 a = 'a' while i < 8: a *= 2 i += 1 print (a)

20th Jul 2020, 3:56 PM
SelvaKumar
5 Answers
+ 2
SELVANITHISH SELVANITHISH try to run it in code playground .. You will get your answer edit: check this https://code.sololearn.com/clw81Jh6mqNM/?ref=app it print 256 times
20th Jul 2020, 4:06 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
SELVANITHISH SELVANITHISH it is going to be 2 raised to power 8 because its doubling itself at every run
20th Jul 2020, 4:09 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
a will be printed 256 times..
20th Jul 2020, 4:07 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Oops!!! i didn't realize the counting increased..Thanks friends.. It's Helped 😊
20th Jul 2020, 4:13 PM
SelvaKumar
0
AKSHAY i got it but.. How's that actually work... Why not 16?
20th Jul 2020, 4:08 PM
SelvaKumar