Q:

Python program to lowercase the character without using a function

belongs to collection: Python basic programs

0

Example:

    Input:
    Hello world!

    Output:
    hello world!

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Python code to lowercase the character without using a function

# 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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python program to find perfect number... >>
<< Python program capitalize the character without us...