-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemoji.py
More file actions
28 lines (24 loc) · 678 Bytes
/
emoji.py
File metadata and controls
28 lines (24 loc) · 678 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
import emoji
# Define a dictionary mapping keywords to emojis
emoji_mapping = {
'happy': ':smile:',
'sad': ':cry:',
'love': ':heart:',
'laugh': ':joy:',
'angry': ':rage:'
}
# Function to generate emoji art from text
def generate_emoji_art(text):
words = text.lower().split()
emoji_art = ''
for word in words:
if word in emoji_mapping:
emoji_art += emoji.emojize(emoji_mapping[word]) + ' '
else:
emoji_art += word + ' '
return emoji_art
# Get user input
text_input = input("Enter your text: ")
# Generate and display the emoji art
generated_art = generate_emoji_art(text_input)
print(generated_art)