Write the Following Pythons Program.

  Write the Following Pythons Program.

===========================================================================

 

1. Even or Odd Checker

Write a Python program that asks the user to enter a number and checks if it is even or odd.

num = int(input(“Enter Number”))

in num%2==0

print(“Even Number”)

else:

print(“Odd Number”)

 

 

 

2. Based on Area of a Rectangle

      Write a Python program that asks the user to enter the length and width of a rectangle and calculates its area.

length =float(input(“Enter length”))

width =float(input(“Enter width”))

area=length*width

print(“Area”,area)

 


3. Multiplication Table Generator

        Write a Python program that asks the user for a number and then prints its multiplication table  from 1 to 10.

 

num = int (input(“Enter a number:”))

for I in range (1,11)

print(num, x, i , “=”, num*1)

 

 

4. Student Grade Calculator

Write a program that takes marks (0-100) as input and assigns a grade based on the criteria:

a) 90–100: A       b) 80–89: B   c) 70–79: C    d) 60–69: D   e) Below 60: F

marks = 85

if marks >= 90:

 print("Grade: A")

elif marks >= 80:

 print("Grade: B")

elif marks >= 70:

 print("Grade: C")

elif marks >= 60:

 print("Grade: D")

else:

 print("Grade: F")

 


5. Voting Eligibility Checker

Write a program that asks for the user’s age and checks if they are eligible to vote (18 years or older).

age = 20

if age >= 18:

 print("Eligible to vote")

else:

 print("Not eligible to vote")


Comments

Popular posts from this blog

Index Class V - Excel - ICT

Interactive Worksheet - Excel-V True or False- Quiz

Interactive Worksheet - Excel-V Fill-in-the-Blanks Quiz