-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranslator.py
More file actions
29 lines (27 loc) · 762 Bytes
/
Translator.py
File metadata and controls
29 lines (27 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
number_grid= [
[1,2,3],#row 0
[4,5,6],#row 1
[7,8,9],#row 2
[0]
#essentially creating 3x4 grid using 2D lists
]
print(number_grid[0][2])
#should print 3
#nested for loop (for-loop in a for-loop)
for row in number_grid:
for col in row:
print(col)
#basic translator
#translates any vowel in the phrase inputted with a 'g'
def translate(phrase):
translation = ""
for letter in phrase:
if letter.lower() in "aeiou":
if letter.isupper():
translation = translation + "G"
else:
translation = translation + 'g'
else:
translation = translation + letter
return translation
print(translate(input("Enter a phrase: ")))