I'm starting off with learning programming in general and so far the hardest thing for me to understand is how to get out of my loops the right way rather than using 'goto'. I hear it's bad practice. I know Python doesn't have the 'goto' feature but if it did, that's the only way I'd know how to get out of the following loop, no matter what language it was in. Loops confuse me. Also, I don't like how much repeated code I use when I program but I don't really know how to avoid it. Probably by using functions, but I don't understand them all that well.
Could someone please take a look at my code and instruct me how to make this work properly? The only issue is at the end when it asks if the user would like to make any more changes and when I enter 'y' it goes into an infinite loop saying 'Have a nice day'. I would like it to go back and ask the user to choose between options A B and C again instead. Everything else appears to be working. If you could also help me shorten my code that would be great. Thanks!
#Global variables
more='y'
#Enter your name
name = raw_input("What is your first name? \n")
##print('Your first name is ') + name
lastName = raw_input("What is your last name? \n")
##print('Your last name is ') + lastName
##raw_input('Press enter to continue...')
fullName = name + " " + lastName
nameList = list(fullName)
print('Your full name is ') + fullName + '. Would you like to \
edit your name? If yes, type "y" and if no type "n".\n'
ans = raw_input()
#Check if changing the name
while more != 'n':
if ans == 'y':
ans=raw_input('Would you like to A) change a letter B) remove a \
letter or C) add a letter?\
\n\n(Note: For all changes write the position of the letter to be affected \
starting at 1 and going from left to right.)\n')
#If yes, change the name
if ans=='A' or ans=='a':
#Change letter
change=input('Which letter would you like to change? ')
change -= 1
ans=raw_input('What would you like to change it to? ')
nameList[change]=ans
#Change the name
fullName = ''.join(nameList)
#Check if you want more changes
more=raw_input("Your name is now " + fullName + ".\n" + "Would you \
like to do anything else? Type 'y' if yes or 'n' if no. ")
elif ans=='B' or ans=='b':
#Remove letter
remove=input('Which letter would you like to remove? ')
remove -= 1
del nameList[remove]
#Change the name
fullName = ''.join(nameList)
#Check if you want more changes
more=raw_input("Your name is now " + fullName + ".\n" + "Would you \
like to do anything else? Type 'y' if yes or 'n' if no. ")
elif ans=='C' or ans=='c':
#Add letter
add=input('After which letter would you like to add one? ')
ans=raw_input('What letter would you like to add? ')
nameList.insert(add,ans)
#Change the name
fullName = ''.join(nameList)
#Check if you want more changes
more=raw_input("Your name is now " + fullName + ".\n" + "Would you \
like to do anything else? Type 'y' if yes or 'n' if no. ")
#Otherwise say goodbye
else:
print('Have a nice day.')