I am doing some practice and want to change 'macdonald' to 'MacDonald' However, my output is just displaying the last value that is 'True', which is 'D'. How do I have the program display the full text?
name = 'macdonald'
def myfunc(name):
for x in name:
finalName = ""
if x == name[0] or name[3]:
finalName += x.capitalize()
else:
finalName += x
return finalName