School assignment asking you to enter name and string. Use the name to determine the initials and remove the initials from the string. Print the original name, original string, initials, and resulting string.
I'm not sure how to proceed.
chars doesn't seem to appear in print "Initials are %s..." in the first function
can't figure out how to delete the parameter chars from txt.
Code:
def main():
global chars, txt, fullName
fullName = raw_input("Please input your name: ")
txt = raw_input("Type in any string: ")
chars = ''
getInitials(fullName)
print "Full name is %s. Original String is %s" % (fullName, txt)
removeChars(txt,chars)
print "Initials are %s. Resulting string is %s" %(chars, txt)
def getInitials(fullName):
chars = ''.join(name[0].upper() for name in fullName.split())
return
def removeChars(txt, chars):
for char in txt:
if char in chars:
txt = txt.replace(char,'')
return txt
main()