'How would I use python to print out alternating upper and lower case letters that the user has input?
I need to Convert all upper-case letters that are input by the user to print as lowercase letters, and I need all lower-case letters input by the user to print as upper-case letters, and i can't seem to figure out how to do it or why the commands work. I also need to put a random symbol between the letters and this is mainly the part that I am currently struggling with. Any help is appreciated!
Solution 1:[1]
print("Hello, World!")
i =input()
a= ""
b=""
for Ih in i:
if Ih== Ih.upper():
a+=Ih.lower ()
elif Ih== Ih.lower():
a+=Ih.upper()
print(a)
for i in a :
b+=i+ "r" #insert random
Print out b and see the result!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user18485167 |
