Python program to lowercase the character without using a function

Lowercase the character: Here, we will figure out how to lowercase the character without utilizing a capacity in Python?

In this article, we will go for de-promoting the characters for example change from lowercase to capitalized without utilizing any capacity. This article depends on the idea that how inbuilt capacity plays out this errand for us.

Composing code to take client contribution as a string and afterwards de-underwrite each letter present in the string.

Along these lines, we should compose a program to play out this assignment.

Key: The distinction between the ASCII estimation of An and an is 32

Example:

    Input:
    Hello world!

    Output:
    hello world!

Python code to lowercase the character without utilizing a capacity:

# Python program to lowercase the character 
# without using a function
st = input('Type a string: ')
out = ''
for n in st:
    if n not in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
        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: HHJHJHFF$%*@#$
-----> hhjhjhff$%*@#$

Third run:
Type a string: abcds14524425way
-----> abcds14524425way

Leave a Comment

error: Alert: Content is protected!!