Skip to content

Commit

Permalink
Added python program to toggle each character in a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakshithrai authored Oct 27, 2024
1 parent 80d3d7d commit ae4eb22
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Python/togglechar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#take user input
String = 'GuDDuBHaiyA'
#initialize other empty String
String1 = str()
#iterate through String
for i in String:
#check the case of each iterator
if i.isupper():
#change it to opposit case
i = i.lower()
#Concat each iterator to String1
String1 = String1 + i
else:
i = i.upper()
String1 = String1 + i
#print String1
print(String + ' after changing ' + String1)

0 comments on commit ae4eb22

Please sign in to comment.