#use "raw_input()" instead of "prompt()" because we want Python to record the user's input user = raw_input("Hello. My name is Ryan. I am your AI Assistant. I will be able to translate English words into Korean for you. Please enter an English word you would like for me to begin translating... ").lower(); #use ".lower()" because we want "raw_input" to turn all user inputs to lower case letters so it's easier to convert #e.g. For example, if someone input "Hello" but we only define "hello", then python will error it #we will define all the translations here in one block to keep the code clean hello = "annyeonghaseyo"; clarke = "keullakeu"; butthole = "ddonggoo mmong"; dick = "gochu"; anal = "ddonggoo mmong"; pussy = "jjamji"; blowjob = "tah gyuuk jagup"; #time for the actual translations using Python's if/elif/else statements #use "capitalize()" to capitalize the first letter of the printed string for a cleaner look #use "isdigit()" for the last elif statement just in case the user inputs a number and not a word if user == "hello": print user.capitalize() + " is " + hello + " in Korean!"; elif user == "clarke": print user.capitalize() + " is " + clarke + " in Korean!"; elif user == "butthole": print user.capitalize() + " is " + butthole + " in Korean!"; elif user == "dick": print user.capitalize() + " is " + dick + " in Korean!"; elif user == "anal": print user.capitalize() + " is " + anal + " in Korean!"; elif user == "pussy": print user.capitalize() + " is " + pussy + " in Korean!"; elif user == "blowjob": print user.capitalize() + " is " + blowjob + " in Korean!"; elif user.isdigit(): print user + " is a number! Please restart the program and enter a word. I can't translate numbers yet!"; else: print "Sorry, I don't know what " + user + " is in Korean. My vocabulary is not that big yet!"; #that's it, now we're done
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question