Python code to capitalize the character without using a function
# Python program to capitalize the character
# without using a function
st = input('Type a string: ')
out = ''
for n in st:
if n not in 'abcdefghijklmnopqrstuvwqxyz':
out = out + n
else:
k = ord(n)
l = k - 32
out = out + chr(l)
print('------->', out)
Output
First run:
Type a string: Hello world!
-------> HELLO WORLD!
Second run:
Type a string: 12345Hello @123$#
-------> 12345HELLO @123$#
Third run:
Type a string: 82918298198291898A
-------> 82918298198291898A
Python code to capitalize the character without using a function
Output
need an explanation for this answer? contact us directly to get an explanation for this answer