-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfaces.py
More file actions
24 lines (17 loc) · 822 Bytes
/
faces.py
File metadata and controls
24 lines (17 loc) · 822 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
# Create a program that prompts the user for input and then outputs :) or :( emojis
def convert(text: str) -> str:
return text.replace(":)", "🙂").replace(":(", "🙁")
def main():
# Ask the user name
name = input("What's your name? ").strip().title()
# Say hello to the user and explain the program
print(f"Hello, {name}! I am here to help you by transcribing your happy or sad faces into emojis.")
# Ask the user for a sentence with happy or sad faces
sentence = input(f"Please {name}, tell me the sentence with :) or :( ").strip()
# Output the sentence with emojis
print("Here is your sentence:")
print(convert(sentence))
# Say goodbye to the user
print(f"I hope I've been helpful, {name}. Goodbye!")
if __name__ == "__main__":
main()