0% found this document useful (0 votes)
11 views4 pages

STD IX PYTHON PART 1

Uploaded by

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

STD IX PYTHON PART 1

Uploaded by

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

Shree Swaminarayan Academy

Python Programming
Std : IX
II Sem coding Portion
(Part –I)

Mrs.Dimple Patel (TGT Computer) Page 1


Shree Swaminarayan Academy
Program 1: Program to get your name , age and then print it.
name= input("Enter your Name:")
age= input("Enter your Age:")
print(name)
print(age)

Program 2: Program to print the sum of two numbers using int() function:
num1=int(input("enter no. 1 ="))
num2=int(input("enter no. 2 ="))
sum = num1 + num2
print(sum)

Program 3: Program to print the product of two numbers using int() function:
num1=int(input("enter value 1"))
num2=int(input("enter value 2"))
product=num1*num2
print("the product of 2 no. is", product)

Program 4: Program to find the average of three numbers.


num1=int(input("enter any no."))
num2=int(input("enter any no."))
num3=int(input("enter any no."))
total = num1 + num2 + num3
avg = total/3
print("the sum is ",total)
print("the avg is ",avg)

Program 5: Program program to convert Kilogram into Grams.


kg=int(input("enter kg"))
gm=kg*1000
print("total gm is",gm)

Mrs.Dimple Patel (TGT Computer) Page 2


Shree Swaminarayan Academy
Program 6: Program program to calculate area of a rectangle.
length=int(input("enter length of rectangle"))
breadth=int(input("enter breadth of rectangle"))
area=length*breadth
print("the area of rectangle ",area)
Program 7: Program to check if the given number is negative.
num= -2
if num<0:
print("Number is negative")

Program 8: Program to print the largest between the two numbers.


Num1=45
Num2=85
if num1>num2:
print("num1 is greater than num2")
else:
print("num2 is greater than num1")
Program 9: Program to check whether you are eligible to vote or not.
age=int(input("enter your age"))
if age >=18 :
print ("you are eligible to vote")
else:
print("you are not eligible to vote")
Program 10: Program to check whether the shape is square or rectangle
based on dimension.
l=int(input("enter length"))
b=int(input("enter breadth"))
if l==b :
print("it is square")
else :
print("it is rectangle")

Mrs.Dimple Patel (TGT Computer) Page 3


Shree Swaminarayan Academy
Program 11: Program to check whether the market or school is near by home.
dis1=int(input("Enter the distance of home to market "))
dis2=int(input("Enter the distance of home to school "))
if dis1<dis2 :
print("Market is near by Home")
else :
print("School is near by Home")

Program 12: Program to check whether a triangle is equilateral or not.


angle1=int(input("Enter First Angle"))
angle2=int(input("Enter second Angle "))
angle3=int(input("Enter third Angle "))
if angle1== angle2== angle3 :
print("it is an equilateral triangle")
else :
print("it is not an equilateral triangle")

Program 13: Program to print lesser weight between two kids.


kid1=int(input("Enter the weight of the First Kid: "))
kid2=int(input("Enter the weight of the Second Kid: "))
if kid1<kid2:
print ("The weight of Kid 1 is Lesser than Kid 2")
else :
print ("The weight of Kid 2 is Lesser than Kid 1")
Program 14: Program to check whether the given letter is vowel or a
consonant.
alpha=input("Enter any letter")
if alpha =='a' or alpha =='e' or alpha =='i' or alpha =='o' or alpha =='u':
print("it is a vowel")
else:
print("it is a consonant")

Mrs.Dimple Patel (TGT Computer) Page 4

You might also like