0% found this document useful (0 votes)
18 views5 pages

Practical 2

The document contains a series of Python programs that demonstrate basic programming concepts such as checking if a number is even or odd, finding the greatest of three numbers, determining grades, and checking for leap years. Each program includes sample input and output to illustrate its functionality. The code snippets are straightforward and serve as practical examples for beginners in programming.

Uploaded by

prayasambawade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Practical 2

The document contains a series of Python programs that demonstrate basic programming concepts such as checking if a number is even or odd, finding the greatest of three numbers, determining grades, and checking for leap years. Each program includes sample input and output to illustrate its functionality. The code snippets are straightforward and serve as practical examples for beginners in programming.

Uploaded by

prayasambawade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Roll no .

41

Experiment no. 2

Code:
1: Program to Check even or odd no.

num = int (input("Enter a Number :"))


if num < 0:
print("Number Entered is Negative")
else:
print("Number Entered Is Positive")

Output:
Enter a Number :45
Number Entered Is Positive

Enter a Number :-2


Number Entered is Negative
2: Program to Check the Greater no. Among 3 no.

if num1 > num2 and num3 :


print("Num 1 is greater")
if num2 > num1 and num3 :
print("Num 2 is greater")
if num3 > num1 and num2 :
print("Num 3 is greater")

Output:
Enter 1st Number :7
Enter 2nd Number :45
Enter 3rd Number :35
Num 2 is greater
3: Program to Check Grade

Grade = int (input("Enter your grade :"))

if Grade >= 75 :
print("First Class Distiction")

elif Grade >=60 :


print("First Class")

elif Grade >= 50 :


print("Pass")

elif Grade < 50 :


print("Fail")

Output:
Enter your grade :89
First Class Distiction
4: Program to Check the no is Even or Odd

num = int (input("Enter any Number :"))

if num % 2 ==0 :
print("Num is Even ")

else :
print("Num is Odd")

Output:

Enter any Number :78


Num is Even

Enter any Number :3


Num is Odd
5: Program to Check Leap Year

Year = int (input("Enter a Year :"))

if Year % 4 == 0:
print("It's a Leap Year ")

else :
print("It's not a Leap Year")

output:
Enter a Year :2005
It's not a Leap Year

Enter a Year :2004


It's a Leap Year

You might also like