-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcasechange.py
More file actions
33 lines (27 loc) · 834 Bytes
/
casechange.py
File metadata and controls
33 lines (27 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
str = input("enter string : ")
def lowercase(str):
for i in range(len(str)):
if str[i] >= 'A' and str[i] <= 'Z':
print(chr(ord(str[i]) + 32), end='')
else :
print(str[i], end='')
print()
lowercase(str)
def uppercase(str):
for i in range(len(str)):
if str[i] >= 'a' and str[i] <= 'z':
print(chr(ord(str[i]) - 32), end='')
else :
print(str[i], end='')
print()
uppercase(str)
def togglecase(str):
for i in range(len(str)):
if str[i] >= 'A' and str[i] <= 'Z':
print(chr(ord(str[i]) + 32), end='')
elif str[i] >= 'a' and str[i] <= 'z':
print(chr(ord(str[i]) - 32), end='')
else :
print(str[i], end='')
print()
togglecase(str)