Skip to content
โ† Back to Community
Text to Emoji
Profile icon
h
has Hacker Plan
InvisibleOne

It isn't perfect yet but here is my in progress text to emoji converter. Have fun!

Voters
Profile icon
Leroy01010
Profile icon
Soccer135246
Profile icon
Spacecraft
Profile icon
Whacko
Profile icon
InvisibleOne
Comments
hotnewtop
Profile icon
Spacecraft

Clever idea! It seems like your code would benefit from a dictionary in this case, which would eliminate all those IF statements. Something like this might help to cut down on the length:

imoji = {'happy':'๐Ÿ˜€','glad':'๐Ÿ˜ƒ','smile':'๐Ÿ˜„','joy':'๐Ÿ˜','laugh':'๐Ÿ˜†','laughing':'๐Ÿ˜‚', 'content':'โ˜บ๏ธ','cheese':'๐Ÿ˜Š','angel':'๐Ÿ˜‡','decent':'๐Ÿ™‚','upside-down':'๐Ÿ™ƒ','wink':'๐Ÿ˜‰', 'calm':'๐Ÿ˜Œ','glad':'๐Ÿ˜ƒ','lovee':'๐Ÿ˜','kiss':'๐Ÿ˜˜','yum':'๐Ÿ˜‹','yummy':'๐Ÿ˜›','eww':'๐Ÿ˜', 'ew':'๐Ÿ˜','strange':'๐Ÿ˜œ','silly':'๐Ÿคช','really':'๐Ÿคจ','study':'๐Ÿง','nerd':'๐Ÿค“','cool':'๐Ÿ˜Ž', 'starstruck':'๐Ÿคฉ','party':'๐Ÿฅณ','sly':'๐Ÿ˜','sad':'๐Ÿ˜ž','dissapointed':'๐Ÿ˜”','downhearted':'๐Ÿ˜ฃ', 'wail':'๐Ÿ˜ซ','cry':'๐Ÿ˜ฉ','weep':'๐Ÿ˜ญ','beg':'๐Ÿฅบ','rage':'๐Ÿ˜ค','anger':'๐Ÿ˜ ','angry':'๐Ÿ˜ก', 'insane':'๐Ÿคฌ','incredible':'๐Ÿคฏ','guilty':'๐Ÿ˜ณ','frozen':'๐Ÿฅถ','cold':'๐Ÿฅถ','horror':'๐Ÿ˜ฑ', 'horrified':'๐Ÿ˜ฑ','yay':'๐Ÿค—','think':'๐Ÿค”','embarrased':'๐Ÿคญ','silent':'๐Ÿ˜ถ','lame':'๐Ÿ˜', 'frightened':'๐Ÿ˜ฌ','afraid':'๐Ÿ™„','stunned':'๐Ÿ˜ฏ','sleepy':'๐Ÿฅฑ','sleep':'๐Ÿ˜ด','sleeping':'๐Ÿ˜ด', 'drooling':'๐Ÿคค','dead':'๐Ÿ˜ต','sick':'๐Ÿคข','barf':'๐Ÿคฎ','toxic':'๐Ÿ˜ท','hurt':'๐Ÿค•','cowboy':'๐Ÿค ', 'menace':'๐Ÿ˜ˆ','monster':'๐Ÿ‘น','clown':'๐Ÿคก','poop':'๐Ÿ’ฉ','skull':'๐Ÿ’€','ghost':'๐Ÿ‘ป', 'crossbones':'โ˜ ๏ธ','alien':'๐Ÿ‘ฝ','enemy':'๐Ÿ‘พ','robot':'๐Ÿค–','jakolantern':'๐ŸŽƒ','cat':'๐Ÿ˜บ', 'wave':'๐Ÿ‘‹','hand':'๐Ÿคš','highfive':'๐Ÿ–','spok':'๐Ÿ––','perfect':'๐Ÿ‘Œ','small':'๐Ÿค','up':'โ˜๏ธ', 'down':'๐Ÿ‘‡','right':'๐Ÿ‘‰','left':'๐Ÿ‘ˆ','awesome':'๐Ÿ‘','like':'๐Ÿ‘','dislike':'๐Ÿ‘Ž','punch':'๐Ÿค›', 'clap':'๐Ÿ‘','brain':'๐Ÿง ','hands':'๐Ÿ‘','arm':'๐Ÿ’ช','leg':'๐Ÿฆต','foot':'๐Ÿฆถ','ear':'๐Ÿ‘‚', 'hear':'๐Ÿ‘‚','hands':'๐Ÿ‘','nose':'๐Ÿ‘ƒ','teeth':'๐Ÿฆท','tooth':'๐Ÿฆท','bones':'๐Ÿฆด','look':'๐Ÿ‘€', 'eye':'๐Ÿ‘','tongue':'๐Ÿ‘…','lips':'๐Ÿ‘„','blood':'๐Ÿฉธ','smooch':'๐Ÿ’‹','family':'๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ','dude':'๐Ÿ‘ฑโ€โ™‚๏ธ', 'man':'๐Ÿ‘ฑโ€โ™‚๏ธ','gal':'๐Ÿ‘ฉโ€๐Ÿฆณ','woman':'๐Ÿ‘ฉโ€๐Ÿฆณ','girl':'๐Ÿ‘ง','boy':'๐Ÿ‘ฆ','baby':'๐Ÿ‘ถ','is':'=','for':'4', 'four':'4','the':'โ•','soon':'๐Ÿ”œ','food':'๐ŸŒฎ','water':'๐Ÿ’ง','bob':'๐Ÿงธ','a':'๐Ÿ…ฐ๏ธ','squid':'๐Ÿฆ‘', 'squids':'๐Ÿฆ‘','cookie':'๐Ÿช','how':'โ‰๏ธ','are':'ยฎ๏ธ','can':'๐Ÿคจ','you':'๐Ÿ—ฃ','eat':'๐Ÿ˜‹', 'pizza':'๐Ÿ•','nasty':'๐Ÿคฌ'} while True: sentence = input("Sentence you would like to be translated into Emoji: ") out = [] b = sentence.lower() l = b.split() for x in l: if x in imoji.keys(): out.append(imoji[x]) else: out.append(x) x = ' '.join(out) print(x)
Profile icon
InvisibleOne

Thanks @Spacecraft, I think you are right. I was going to go with a dictionary but changed my mind since I thought it would be easier to simply use the for loop. I might use that as I make it larger

Profile icon
Leroy01010

cool!!

(i was searching emoji and i found this)

Profile icon
InvisibleOne
Profile icon
Leroy01010
Profile icon
Whacko

nice!

Profile icon
InvisibleOne
Profile icon
Whacko

@InvisibleOne No problem.