# File: strchcase.py # Changes case of characters in a string # # Matt Bishop, ECS 10, Spring 2014 # # instr = input("Enter a string: ") # put quotes around the string to show its boundaries when it is printed prstr = '"' + instr + '"' # # now do the transformations # transstr = '"' + instr.capitalize() + '"' print("Capitalizing the first letter of", prstr, "gives", transstr) transstr = '"' + instr.title() + '"' print("Making", prstr, "into a title gives", transstr) transstr = '"' + instr.lower() + '"' print("Making all letters of", prstr, "lower case gives", transstr) transstr = '"' + instr.upper() + '"' print("Making all letters of", prstr, "upper case gives", transstr) transstr = '"' + instr.swapcase() + '"' print("Swapping the case of the letters in", prstr, "gives", transstr)