Underwrite the character: Here, we will figure out how to underwrite the character without utilizing a capacity in Python?
In this article, we will go for underwriting the characters for example change from lowercase to capitalized without utilizing any capacity. Does this article depend on the idea that how inbuilt capacity play out this undertaking for us?
Along these lines, how about we compose a program to play out this errand.
Key: The contrast between the ASCII estimation of An and an is 32
Input: Hello world! Output: HELLO WORLD!
Python code to underwrite the character without utilizing a capacity:
# 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)
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