Why doesn't this work?


#1

x=raw_input ("Enter a word")
def Piglatin():
first_letter = x[0]
Rest_Word = x[0:]
str1="ay"
Piglatin = Rest_Word + first_letter + str1
print Piglatin


#2

if you are going to write it as a method then

def Piglatin():
    x=raw_input ("Enter a word")
    first_letter = x[0]
    Rest_Word = x[1:]
    str1="ay"
    Piglatin = Rest_Word + first_letter + str1
    print Piglatin
    
Piglatin()

#3

import re

condition = re.compile(r'[a-zA-Z]+')
yourword = raw_input("Your Name:")

while not condition.match(yourword):
yourword = raw_input("Your Name:")
pigLatin= yourword[1:]+yourword[0]+("ay")
print pigLatin