Lab 7: Part 2. Nested For Loop Warm Up
Worksheet Links
Worksheet: click here for worksheet (flip to backside)
A. Warm up exercises
Write what each snippet of code produces:
-
for x in [1, 4, 10]: for y in [7, 8]: print (x + y)
-
for let in 'pie': for num in [2, 5, 0]: print (let * num) print('hi')
-
for num1 in range(1,4): for num2 in range(1,num1+1): print ('O' * num1 + 'H' * num2)