Question
11.2 HW5 Part B: Case Swapper You are provided with a partially completed Python program. The program depends on a function def swap_case(word). This function
11.2 HW5 Part B: Case Swapper
You are provided with a partially completed Python program. The program depends on a function def swap_case(word). This function will change all lower case letters to upper case and all upper case letters to lower case.
Complete the function. Do not change any of the other code in the file. If you implement the function correctly, the rest of the code will work.
Here is an example execution trace.
Welcome to Case Swapper 1.0 Enter Text (or 'exit'): 1000 Case Swapped Version: 1000 Enter Text (or 'exit'): OranGes Case Swapped Version: oRANgES Enter Text (or 'exit'): OrANGES Case Swapped Version: oRanges Enter Text (or 'exit'): ROBOT Case Swapped Version: robot Enter Text (or 'exit'): RoBoT Case Swapped Version: rObOt Enter Text (or 'exit'): Exit
Given code:
def swap_case(word): return "I don't work!" #------------Make no changes below this line--------------- print("Welcome to Case Swapper 1.0") my_text = input("Enter Text (or 'exit'): ") while my_text.lower()!="exit": print("Case Swapped Version:",swap_case(my_text)) my_text = input("Enter Text (or 'exit'): ")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started