For the code below, write a prediction on what it will output. Then run the code and state if your prediction was accurate or not. If your prediction is incorrect, make sure you understand why.
for i in range ( 5 ): print (i + 1 ) |
for i in range ( 5 ): print (i) i = i + 1 |
x = 0 for i in range ( 5 ): x + = 1 print (x) |
x = 0 for i in range ( 5 ): for j in range ( 5 ): x + = 1 print (x) |
for i in range ( 5 ): for j in range ( 5 ): print (i, j) |
for i in range ( 5 ): for j in range ( 5 ): print ( "*" , end = "") print () |
for i in range ( 5 ): for j in range ( 5 ): print ( "*" , end = "") print () |
for i in range ( 5 ): for j in range ( 5 ): print ( "*" , end = "") print () |
# This is supposed to sum a list of numbers # What is the mistake here? my_list = [ 5 , 8 , 10 , 4 , 5 ] i = 0 for i in my_list: i = i + my_list[i] print (i) |
for i in range ( 5 ): x = 0 for j in range ( 5 ): x + = 1 print (x) |