Multiple Choice on Python concepts including basic syntax, for-loop, if-statements, correctly concatenate strings and integers for print statements.
Which statement will print the numbers 1, 2, 3, 4, and 5?
for i in range(0,5): print i
for i in range(1:6): print i
for i in range(1,6): print i
for i in range (0:5): print i
Choose the code that will print true statements:
for i in range(0:10):
if i < 7:
print i + " is less than 7."
else:
print i + " is greater that or equal to 7."
for i in range(0:10):
if i < 7:
print str(i) + " is less than 7."
else
print str(i) + " is greater that or equal to 7."
for i in range(0,10):
if i < 7:
print i + " is less than 7."
else
print i + " is greater that or equal to 7."
for i in range(0,10):
if i < 7:
print str(i) + " is less than 7."
else:
print str(i) + " is greater that or equal to 7."