pyg = 'ay' #This ads 'ay' to the end of the word original = raw_input('Enter a word if you dare:') #This is user input word = original.lower() #This makes the word lowercased first = word[0] #This stores the first letter of the word new_word = word + first + pyg #This takes the word and adds the stored first letter and the 'ay' to the end of the word new_word = new_word[1:len(new_word)] #This makes new_word equivalent to the second letter of the word to the end of the word if len(original) > 0 and original.isalpha(): #The first part checks to see if the original word entered actually has characters and the second part checks to see if the word contains letters, not just integers. print new_word #This prints our desired translation. else: #If the user doesn't enter a word, the console returns this. print 'Um, try using letters Nimrod!' #This is what gets printed.
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