More on else statements question | SoloLearn: Learn to code for FREE!

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")

2/21/2017 8:55:31 PM

mik

2 Answers

New Answer

+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).

0

yes it crossed my mind but safer to check thanks