Skip to content

Commit 1e7a141

Browse files
Added case converter script
1 parent c5d9bf5 commit 1e7a141

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Python Programs/case_converter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
s = input("Enter a string: ")
2+
new_s = ""
3+
for c in s:
4+
if 'A' <= c <= 'Z':
5+
new_s += chr(ord(c) + 32)
6+
elif 'a' <= c <= 'z':
7+
new_s += chr(ord(c) - 32)
8+
else:
9+
new_s += c
10+
print("Converted string:", new_s)

0 commit comments

Comments
 (0)