When I enter a last name, like mcstuff
, it prints Welcome Joe Mcstuff!
. Instead, I want it to say Welcome Joe McStuff!
.
I don't know why the 3rd letter won't capitalize, and I feel like I am doing something obvious wrong.
Here's my code:
#Just defining strings needed for later
Mc = "Mc"
O = "O'"
#What is your name?
name = raw_input('What is your first name? ')
name2 = raw_input('What is your last name? ')
#Setting up the grammar for all of these weirdly typed names
#Lowering all the letters of the names
game = name.lower()
game2 = name2.lower()
#Separating out the rest of the name from the first letter
lame = game[1:len(game)]
lame2 = game2[1:len(game2)]
#The names with the first letter being uppercase
Name = game[0].upper() + lame
Name2 = game2[0].upper() + lame2
#For the names with a Mc in it
#If the first 2 letters of the last name have "MC" or "Mc", they will get edited by this conditional
#The last name is now transformed by adding an Mc to an uppercase 3rd letter (assuming the first to letters are some variation of Mc), and adding in the rest of the letters from the fourth letter
if Name2[0:1] == "mc" or Name2[0:1] == "MC" or Name2[0:1] == "Mc":
Last_Name = Mc + Name2[2].upper() + Name2[3:len(Name2)]
#For the names with an O'name in it
#If the first letter has an O, it will get edited by this conditional
#Same as the process with the names with an Mc in it, except if they have an O'(name)
elif Name2[0:1] == "O'" or Name2[0:1] == "o'":
Last_Name = O + Name2[2].upper() + Name2[3:len(Name2)]
#For the regular names, or names not caught by the conditionals
else:
Last_Name = Name2
#For the liars with fake names, or the people unfortunate enought to have this long of a name
if len(Name) + len(Name2) > 45:
print "STOP LYING!"
#Lets finally print this beast
else:
print "Welcome " + Name + " " + Last_Name + "!"