Capturing characters within a string


#1



I am trying to convert a word from English to Pig Latin. This involves taking the first letter of user input and putting it at the end, then adding letters 'ay' to end. Here is code I have so far.

def PigLatin():


print "Welcome to the Pig Latin translator"
print "Input a word in English"
what_the_user_input = raw_input("Type in word and hit 'Enter'.")
if type(what_the_user_input) == string:
return "This is a string!"
else:
return "This is not a string!"
tail = what_the_user_input(1:)

not able to parse or capture single characters within a string


Replace this line with your code.


#2

First, please format your code.

Second, function names should start with a lowercase letter.

Last, to access indices you use brackets as so:

"Jeff"[0] #Gives out "J"

"Shrek"[2] #Gives out "r"

"John Cena"[4] #Gives out " "