Homework:

Write a while loop that prints all numbers from 1 to 50 except multiples of 4.

Write nested for loops to represent a “subtraction table” with 10 rows and 10 columns. Ex: first entry is 1 - 1 = 0, entry to the right is 2 - 1 = 1, so on so forth. (Like a multiplication table.)

Resources:

Slides: https://docs.google.com/presentation/d/1BcN5TWLdabkdXMF6rVLxVvfBhRZNo5FZBm7CUdw0yL4/edit?usp=sharing

Code: https://replit.com/join/qjpzhxpkuc-shrav816

Contact:

shravyassathish@gmail.com (mentor)

mailtoarnavpandey@gmail.com (TA)

Make sure to "Add a comment" with your code to the homework in order to submit your homework assignment!

Recordings for the class have been sent out through email :)

Computer = 0

while Computer < 50:

Computer += 1

if Computer % 4 == 0:

continue

print(Computer)

Part 1:

num = 0

while num < 50:

num += 1

if num % 4 == 0:

continue

print(num)

Part 2-Subtraction Table:

for i in range (1,11):

for k in range(1,11):

print(i - k, end = '\t'

if k == 10:

print('\n")

`beep = 0 while beep < 50: beep += 1 if beep % 4 == 0: continue print(beep) for blep in range(10): for bleeep in range(10): print(blep - bleeep, end='\t') print('\n') print('This is the substraction table!')`

`x = 0 while x < 50: x += 1 if x % 4 == 0: continue print(x) for y in range(-1, 10, 1): for x in range(-1, 10, 1): print(x - y, end='\t') print("\n")`

`num = 1 while num <= 50: if num % 4 != 0: print(num) num += 1 ### print('\033[1m' + "\n 1 2 3 4 5 6 7 8 9 10\n" + '\033[0m') # Don't worry about these escape characters (\033[1m), # they are put there simply to make it easier to read # in PowerShell; they have no connection whatsoever # with the program. for i in range(10): print('\033[1m' + str(i+1) + '\033[0m', end=" ") for j in range(10): print(str((j+1) - (i+1)) + ", ", end="") if j == 9: print("\n")`

Numbers 1 -> 50 except multiples of 4:

i = 0

while i <= 50:

i += 1

if i % 4 == 0:

continue

print(i)

Subtraction Table

for i in range(1, 11):

for j in range(1, 11):

print(i, "-", j, "=", i - j, sep = "", end = " ")

if j == 10:

print("")