3.8 & 3.10 Notes and Hacks
words = ["alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliett", "kilo",
"lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "xray", "yankee", "zulu"]
inp = input().lower()
lengthInp = len(inp)
wordStart = []
for x in range(len(words)):
wordLetter = words[x]
wordThing = wordLetter[0]
wordStart.append(wordThing)
print(inp)
for i in range(lengthInp):
j = str(inp)[i]
for y in range(len(wordStart)):
if j == str(wordStart[y]):
print(words[y])
keypad = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[" ", 0, " "]]
def print_matrix3(matrix):
for row in matrix: # Iterates through each "row" of matrix. Row is a dummy variable, it could technically be anything. It iterates through each value of matrix and each value is it's own list. in this syntax the list is stored in "row".
# Iterates through each value in row. Again col, column, is a dummy variable. Each value in row is stored in col.
print(*row, end=" ") # Same as 1
print() # Same as 1
print_matrix3(keypad)
keypad = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[" ", 0, " "]]
def print_matrix4(matrix):
for i in range(len(matrix)):
itr = iter(matrix[i])
print(next(itr), next(itr), next(itr))
print_matrix4(keypad)
def print_matrix5(matrix):
i = 0
while i < len(matrix):
j = 0
while j < len(matrix[i]):
print(matrix[i][j], end=" ")
j+=1
print()
i += 1
return
print_matrix5(keypad)
keyboard = [["`", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, "-", "="],
["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]"],
["A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'"],
["Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", " "]]
def print_type(matrix):
inp = input().upper()
for i in range(len(inp)):
j = str(inp)[i]
for row in range(len(matrix)): # Iterates through each "row" of matrix. Row is a dummy variable, it could technically be anything. It iterates through each value of matrix and each value is it's own list. in this syntax the list is stored in "row".
for col in range(len(matrix[row])):
if j == str(matrix[row][col]): # Iterates through each value in row. Again col, column, is a dummy variable. Each value in row is stored in coif j == str(keyword[y]):
print(matrix[row][col], end="") # Same as 1
# Same as 1
print_type(keyboard)
Challenge may or may not be complete
def print_type(matrix):
inp = input().upper()
for i in range(len(inp)):
j = str(inp)[i]
for row in range(len(matrix)): # Iterates through each "row" of matrix. Row is a dummy variable, it could technically be anything. It iterates through each value of matrix and each value is it's own list. in this syntax the list is stored in "row".
for col in range(len(matrix[row])):
if j == str(matrix[row][col]): # Iterates through each value in row. Again col, column, is a dummy variable. Each value in row is stored in coif j == str(keyword[y]):
print(matrix[row][col], end="")
matrix = matrix[row].pop() # Same as 1
# Same as 1
print_type(keyboard)