More on else statements question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

More on else statements question

am i getting this right? the answer for this in tutorial is 6..but if you use i in range (10) so 0,1,2,3,4,5,6,7,8,9...until i=6 code prints 7 What is the largest number this code prints? for i in range(10): if i > 5: print(i) break else: print("7")

21st Feb 2017, 8:55 PM
mik
2 Answers
+ 3
It's kind of a tricky question about types. They ask about a NUMBER, and while i <= 5, it's not a number being printed, but a string (mind the quotes).
21st Feb 2017, 8:59 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
yes it crossed my mind but safer to check thanks
21st Feb 2017, 9:07 PM
mik