Homework
1. Print a pattern where the first row has one A, second row two Bs, third row three Cs, etc.
A
B B
C C C
D D D D
E E E E E
(so on and so forth)
2. Print a pattern where the first row has A, second row has B C, third row D E F, etc.
A
B C
D E F
G H I J
K L M N O
(so on so forth)
Hint: you’ll need an additional variable outside the for loops for the index of string of letters.
3. Create a list of numbers, then use a for loop to multiply all the elements. Next, append a new element while removing a different old one, and then repeat the process of multiplication. Print both products.
Resources:
Class slides: https://docs.google.com/presentation/d/1ML3hll2J9nWQNLFKON2JHnkiJnzUpEy9uPNKTluMnD0/edit?usp=sharing
Class code: https://replit.com/join/qlpoayfbyz-shravyas
Contact Info:
shravyassathish@gmail.com (mentor)
kingericwu@gmail.com (TA)
felixguo41@gmail.com (TA)
letters = ["A","B","C","D","E","F","G","H","I"]
num = len(letters)
nub = 0
for i in range(num):
for j in range(i+1):
print(letters[nub], end = " ")
print("\n")
nub+=1
letters = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","DONE"]
nub=0
for i in range(len(letters)):
for j in range(i+1):
if nub<=int(25):
print(letters[nub], end = " ")
nub+=1
print("\n")