Iteration Hack

Use the list below to turn the first letter of any word (using input()) into its respective NATO phonetic alphabet word

Ex:

list ->

lima india sierra tango

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])
python
papa
yankee
tango
hotel
oscar
november

2D Iteration Hacks

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)
1 2 3 
4 5 6 
7 8 9 
  0   
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)
1 2 3
4 5 6
7 8 9
  0  
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)
1 2 3 
4 5 6 
7 8 9 
  0   
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)
I WAS BORN IN NOVEMBER AND I AM 17 YEARS OLD

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)