forked from Zipcoder/PyPart3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultilingual_greeter.py
More file actions
36 lines (28 loc) · 843 Bytes
/
multilingual_greeter.py
File metadata and controls
36 lines (28 loc) · 843 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
30
31
32
33
34
35
36
def name_input(lang):
'''Promts user for input and returns string'''
name = ""
if lang == "english":
name = input("what is you name")
elif lang == "spanish":
name = input("como te llamas")
else:
name = input("come si chiama")
return name
def get_language():
"""asks user to choose one of three languages"""
a = input("whats you first language? english, spanish, or french?")
return a
def greet_user(lang, name):
'''Takes in the language and greets the user in that language'''
if lang == "english":
print("hello", name)
elif lang == "spanish":
print("hola", name)
else:
print("ciao", name)
def main():
language = get_language()
name = name_input(language)
greet_user(language, name)
if __name__ == "__main__":
main()