I want to convert the lower case of a given string to capital letters and the capital letters to lower case letters.
For example: Initial string: Hello World!
and the resulting output must be hELLO wORLD!
.
My current code is:
# Ask the use to give a string
user_string = input("Please give a string: ")
new_string = user_string
# For each character in the given string
# Check if it is a capital letter and convert it to lower case.
# Check if it is a lower case letter and convert it to capital.
for char in user_string:
if char.islower():
new_string[char]=
if char.isupper():