Uppercase and Lowercase reverser
The program takes in a text file, and reverses the uppercase and lowercase letters. It figures out which is which by seeing if the letter is equal to the letter when it is changed to uppercase, and if it is the same, then write the lowercase version of the letter instead.
starter = open("SCPtesting")
output = open("reversed.txt", "w")
letter = 'a'
while letter != '':
letter = starter.read(1)
if letter.upper() == letter:
output.write(letter.lower())
elif letter.lower() == letter:
output.write(letter.upper())
else:
output.write(letter)
Comments
Post a Comment