Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c
Python program: Check whether the given character is upper or lower case or not

Python program: Check whether the given character is upper or lower case or not

Posted on April 16, 2022

Table of Contents

  • Python program: Check whether the given character is upper or lower case or not
    • Code to find given character is Upper or Lower or not
      • Code to find given character Upper or Lower or not, using if statements
      • Code to find given character Upper or Lower or not, using Ascii value
      • Code to find given character Upper or Lower or not, using Library function

Python program: Check whether the given character is upper or lower case or not

In this article, we will discuss the concept of Python program: Check whether the given character is upper or lower case or not

In this post, we are going to learn how to write a program to  check whether given character is Upper case or lower case or not using if else in Python language

Code to find given character is Upper or Lower or not

Code to find given character Upper or Lower or not, using if statements

In this code, we are going to learn how to check  the given  character is Upper case or lower case or not using if else statements in Python language

Program 1

#python program to check Alphabet is Lowercase or Uppercase
ch=input("Please enter a character: ")
#reading the user input using ch variable
if(ch>='A' and ch<='Z'):
    print(ch," is an uppercase letter")
    #check upper case Alphabet
elif (ch>='a' and ch<='z'):
    print(ch," is a lowercase letter")
    #check lower case Alphabet
else:
    print(ch," is not in Alphabet")
    #Display if the entered character is not Alphabet

 

When the above code is executed, it produces the following result

Case 1

Please enter a character: E
E is an uppercase letter

Case 2

Please enter a character: y
y is a lowercase letter

Case 3

Please enter a character*
* is not in Alphabet

 

Code to find given character Upper or Lower or not, using Ascii value

In this code, we are going to learn how to check  the given  character is Upper case or lower case or not using Ascii value with  if else statements in Python language

Program 2

#python program to check Alphabet is Lowercase or Uppercase
ch=input("Please enter a character: ")
#reading the user input using ch variable
if(ord(ch)>=65 and ord(ch)<=90):
    print(ch," is an uppercase letter")
    #check upper case Alphabet
elif(ord(ch)>=97 and ord(ch)<=122):
    print(ch," is a lowercase letter")
    #check lower case Alphabet
else:
    print(ch," is not in Alphabet")
    #Display if the entered character is not Alphabet

When the above code is executed, it produces the following result

Case 1

Please enter a character: U
U is an uppercase letter

Case 2

Please enter a character: i
i is a lowercase letter

Case 3

Please enter a character: &
& is not an Alphabet

 

Code to find given character Upper or Lower or not, using Library function

In this code, we are going to learn how to check  the given  character is Upper case or lower case or not using Library function in Python language

Program 1

#python program to check Alphabet is Lowercase or Uppercase
ch=input("Please enter a character: ")
#reading the user input using ch variable
if(ch.isupper()):
    print(ch," is a uppercase letter")
    #check upper case Alphabet
elif (ch.islower()):
    print(ch," is a lowercase letter")
    #check lower case Alphabet
else:
    print(ch," is not in Alphabet")
    #Display if the entered character is not Alphabet

When the above code is executed, it produces the following result

Case 1

Please enter a character: g
g is a lowercase letter

Case 2

Please enter a character: S
S is a uppercase letter

Case 3

Please enter a character: ^
^ is not in Alphabet

 

Suggested post

if else in Python language

Operator in Python language

function  in python language

 

Similar post

Java program to print all alphabets in given range

C program to print all alphabets in given range

C++ program to print all alphabets in given range

 

Java program to print all alphabets using loops

C program to print all alphabets using loops

C++ program to print all alphabets using loops

 

Java program to find whether a character is Alphabet or Not

C++ program to find whether a character is Alphabet or Not

C program to check whether a character is Alphabet or Not

Python program to check whether a character is Alphabet or Not

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes