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.