๐Ÿ
B.TECH I YEAR โ€ข II SEMESTER โ€ข R25

Python Programming - Lab Manual

Python Programming Laboratory โ€ข Program Solution

๐Ÿ“˜ R25 Regulation ๐ŸŽ“ I Year ๐Ÿ“š II Semester ๐Ÿ Python Programming ๐Ÿงช Lab Program
Selected Program

triangle using for loop

โ† All Python Programs

Aim:

☛   Write a program to check whether the given input is digit or lowercase character or uppercase character or a special character(use 'if-else-if' ladder)

Solution :


PROGRAM: (check_input_char.py)

 
ch = input ( " Enter a character : " ) 
if ( ord ( ch ) >= 65 and ord ( ch ) <= 90 ) : 
	print ( ch , " is Upper Case Character " ) 
elif ( ord ( ch ) >= 97 and ord ( ch ) <= 122 ) : 
	print ( ch , " is Lower Case Character " ) 
elif ( ord ( ch ) >= 48 and ord ( ch ) <= 57 ) : 
	print ( ch , " is Digit " ) 
else: 
	print ( ch , " is Symbol " )

OUTPUT:

 
Sample Run 1: 
Enter a character : 5
5 is Digit

Sample Run 2: 
Enter a character : H
H is Upper Case Character

Sample Run 3: 
Enter a character : b
b is Lower Case Character

Sample Run 4: 
Enter a character : @
@ is Symbol


๐Ÿ’ป Run This Python Program

triangle using for loop
The selected Python program is loaded automatically into the editor. Edit the program, provide input if required and click Run.

The compiler is embedded using OneCompiler. Your Python program runs inside the embedded Python environment; Study Glance does not execute Python code directly on your web server.
โ† Back to Python Lab Programs ๐Ÿ“š All Lab Manuals