0% found this document useful (0 votes)
3 views24 pages

Program List with complete program for class 9

Uploaded by

nimitsigotiya2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
3 views24 pages

Program List with complete program for class 9

Uploaded by

nimitsigotiya2
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 24

PM SHRI KV NO.

– 1 CHHINDWARA
List of Python Program
CLASS –IX (2023-24)

1.1 WAP to input two numbers and print their sum.


1.2 WAP to input two numbers and subtract them.
1.3 WAP to input two numbers and find their product.
1.4 WAP to input two numbers and divide them.
2. WAP to input length and breadth of a rectangle and print it’s area.
3. WAP to input temperature in Celsius and convert it to farenheit using:(c*9/5+32)
4. WAP to obtain principal amount, rate of interest , time (in years) and calculate simple interest. ( using:
si=(p*r*t)/100.)
5. WAP to determine an individual person is eligible for voting or not.
6. WAP to check if a number is even or odd.
7. WAP to input two numbers and check which one is greater.
8. WAP to input a number and check if it is positive or negative.
9. WAP to input radius of a circle and calculate it’s area.( using : 3.14*r**2)
10. WAP to input length and breadth of a rectangle and calculate it’s perimeter (using: 2*(l+b))
11. WAP WAP that takes the megapixel information of a camera from the user and prints the storage size, in
MB, of a colour picture captured from that camera.
12. WAP WAP that takes the megapixel information of a camera from the user and prints the storage size, in
GB, of a Grayscale video of length 10 seconds at 25 frames per second, recorded from that camera.
13. Write a program to create a list of elements with variety of data type values and display all the elements
in that list.
14. Write a program to create a nested list.
15. Write a program to accept and add an element to the existing list.
16. Write a program to sort the elements of the list.
17. WAP that takes the stage number from the user and prints the AI Project Cycle stage name associated
with the stage number. Like, for 3, it should print Data Exploration.
18. Write a program to reverse the list elements.
19. Write a program to accept two numbers and calculate their exponent.
20. Write a program to create a list and remove the second element from the list.
1.1 Write a programe to input two numbers and print their sum.
# Code:

# 1.1 WRITE A PROGRAME TO PRINT ADDTION OF GIVEN TWO NUMBERS.

num1= int (input("Enter the 1st Value"))

num2= int(input("Enter the 2nd value"))

sum= num1+num2

print("The Entered 2 no. are:", num1, num2)

print("their sum is ",sum)

# Output:

Enter the 1st Value10


Enter the 2nd value10
The Entered 2 no. are: 10 10
their sum is 20

1.2 Write a programe to input two numbers and print their subtraction.
# Code:

# 1.2 WRITE A PROGRAME TO PRINT SUBTRACTION OF GIVEN TWO NUMBERS.

num1= int (input("Enter the 1st Value"))

num2= int(input("Enter the 2nd value"))

sub= num1 - num2

print("The Entered 2 no. are:", num1, num2)

print("their subtraction is ",sub)

# Output:

Enter the 1st Value10


Enter the 2nd value10
The Entered 2 no. are: 10 10
their subtraction is 0

1.3 Write a programe to input two numbers and print their multiplication.
# Code:

# 1.3 WRITE A PROGRAME TO PRINT MULTIPLICATION OF GIVEN TWO NUMBERS.

num1= int (input("Enter the 1st Value"))

num2= int(input("Enter the 2nd value"))

mul= num1 * num2

print("The Entered 2 no. are:", num1, num2)

print("Their multiplication is ",mul)

# Output:

Enter the 1st Value10


Enter the 2nd value10
The Entered 2 no. are: 10 10
Their multiplication is 100

1.4 Write a programe to input two numbers and print their devition.
# Code:

# 1.3 WRITE A PROGRAME TO PRINT DEVITION OF GIVEN TWO NUMBERS.

num1= int (input("Enter the 1st Value"))

num2= int(input("Enter the 2nd value"))

div= num1 / num2

print("The Entered 2 no. are:", num1, num2)

print("Their devition is ",div)

# Output:

Enter the 1st Value10


Enter the 2nd value10
The Entered 2 no. are: 10 10
Their multiplication is 1.0

2. Write a program to input length and breadth of a rectangle and print its area.
# Code:
# to input length & breadth of a rectangle and calculate area

length = float (input("Enter length of the rectangle"))

breadth = float (input("Enter breadth of the rectangle"))

area= length * breadth

print("Rectangle Specifications")

print("Length",length)

print("Breadth", breadth)

print(" Its Area =",area)

# Output:
Enter length of the rectangle10
Enter breadth of the rectangle10
Rectangle Specifications
Length 10.0
Breadth 10.0
Its Area = 100.0
3. Write a program to input temperature in Celsius and convert it to farenheit using:
(c*9/5+32).

# Code:
# Celsius to Fahrenheit

cels = float (input ("Enter temp in celsius:"))

print("Temperature in Celsius is :" , cels)

fahr = cels * 9/5 + 32 # this is the formula to convert

print("Temperature in Fahrenheit is : " , fahr)

# Output
Enter temp in celsius:10
Temperature in Celsius is : 10.0
Temperature in Fahrenheit is : 50.0
4. Write a program to obtain principal amount, rate of interest , time (in years) and
calculate simple interest. ( using: si=(p*r*t)/100.)

# Code:

# To calculate Simple Interest


p = float (input ("Enter the principal amount:"))

r = float (input ("Enter the rate :"))

t = float (input ("Enter the time in year:"))

si= ((p*r*t)/100)

print("The principal amount::" , p)

print("The Rate is:" , r)

print("The time is::" , t)

print("Simple Interest is : " , si)

# Output
Enter the principal amount:1000
Enter the rate :2
Enter the time in year:2
The principal amount:: 1000.0
The Rate is: 2.0
The time is:: 2.0
Simple Interest is : 40.0
5. Write a Program to determine an individual person is eligible for voting or not.

# Code:
# to check if an individual person is eligible for voting or not.
name=str(input("enter your name"))

age=int(input("enter your age"))

if age>=18:
print(name,",you are eligible for voting.")
else:
print(name,",you are not eligible for voting.")
# Output
enter your name Vikash Sahu

enter your age 35

Vikash Sahu ,you are eligible for voting.


6. Write a program to check if a number is even or odd.

# Code:
# to check if a number is even or odd.

num=int(input("enter the number"))

if num%2==0:
print("number is even")
else:
print("number is odd")

# Output
enter the number25
number is odd

enter the number24


number is even
7. Write a program to input two numbers and check which one is greater.

# Code
# TO INPUT TWO NUMBERS AND CHECK WHICH VALUE IS LARGEST
num1=int(input("enter the first number:"))
num2=int(input("enter the second number:"))
if num1>num2:
print(num1,"is greater than",num2)
else:
print(num2,"is greater than",num1)

# Output:
enter the first number:25
enter the second number:20
25 is greater than 20

enter the first number:20


enter the second number:25
25 is greater than 20
8. Write a program to input a number and check if it is positive or negative.
# Code
# TO INPUT A NUMBER AND CHECK WHICH IS POSITIVE OR NEGATIVE.

number=int(input("enter the first number:"))

if number>0:
print(number,"is Positive Number")
else:
print(number,"is Negative Number")

# Output:

enter the first number:10


10 is Positive Number

enter the first number:-10


-10 is Negative Number
9. Write a program to input radius of a circle and calculate it’s area.
( using : 3.14*r**2)
# Code:

# TO Print area of Circle using formula area = pi*radius**2.

radius=int(input("Enter the Radius Value:"))

pi=3.14

area = pi*radius**2

print("The area of circle is:" , area)


# Output:

Enter the Radius Value:20


The area of circle is: 1256.0
10. Write a program to input length and breadth of a rectangle and calculate it’s perimeter
(using: 2*(l+b))
# Code :

# program to obtain length and bredth of a rectangle and to calculate its perimeter
length = float(input("enter the length of the rectangle:"))
breadth = float(input("enter the breadth of the rectangle:"))
perimeter = 2*(length+breadth)
print("rectangle specifications")
print("Length",length)
print("Breadth",breadth)
print("Perimeter is",perimeter)

# Output:

enter the length of the rectangle:10


enter the breadth of the rectangle:20
rectangle specifications
Length 10.0
Breadth 20.0
Perimeter is 60.0
11. WAP that takes the megapixel information of a camera from the user and
prints the storage size, in MB, of a colour picture captured from that camera.

# Code:
'''WAP that takes the megapixel information
of a camera from the user and prints the
storage size, in MB,
of a colour picture captured from that camera.'''

x=int(input("Enter Mega-pixels of the camera:"))


y=x*(10**6)
z=3*y/(1024*1024)
print("It captures a colour image of size:", round(z,0), "MB")

# Output:

Enter Mega-pixels of the camera:50


It captures a colour image of size: 143.0 MB
12. WAP that takes the megapixel information of a camera from the user and
prints the storage size, in GB, of a Grayscale video of length 10 seconds at 25
frames per second, recorded from that camera.
Code:
‘’’WAP that takes the megapixel information of a camera from the user and prints the storage size, in
GB, of a Grayscale video of length 10 seconds at 25 frames per second, recorded from that camera.’’’

x=int(input("Enter Mega-pixels of the camera:"))


y=x*(10**6)
z=(25*10*y)/(1024*1024*1024)
print("It records a 10-seconds Grayscale video of size:", round(z,0), "GB")

# Output:

Enter Mega-pixels of the camera:50


It records a 10-seconds Grayscale video of size: 12.0 GB
13. Write a program to create a list of elements with variety of data type values
and display all the elements in that list.

CODE:

''' write a program to create a list of elements with


variety of data types values and display all the
elements in that list.'''

mylist=[ ]
mylist=[1,"aman",90.5,2,"ajay",94.8,3,"bhumika",97.00]
print(mylist)

# Output:

[1, 'aman', 90.5, 2, 'ajay', 94.8, 3, 'bhumika', 97.0]


14. Write a program to create a nested list.

Code:

#write a program to create a nested list.

mylist=[ ]

studentlist=[[1,"aman",90.5],[2,"ajay",94.8],[3,"bhumika",97.00]]

print(studentlist)

# Output

[[1, 'aman', 90.5], [2, 'ajay', 94.8], [3, 'bhumika', 97.0]]


15. Write a program to accept and add an element to the existing list.

# Code:
'''write a program to accept and add an element to
the existing list.'''

studentlist=["aman","ajay","bhumika"]
print(studentlist)
newname=str(input("enter the name :"))
studentlist.append(newname)
print(studentlist)

# Output

['aman', 'ajay', 'bhumika']


enter the name : anuj pahade
['aman', 'ajay', 'bhumika', ' anuj pahade']
16. Write a program to sort the elements of the list.

# Code:

'''write a program to sort the elements of the list.'''

studentlist=["bhumika","sejal","christina","udayraj","anuj"]

print("list of items before sorting",studentlist)

studentlist.sort()

print("list of items after sorting",studentlist)

# Output

list of items before sorting ['bhumika', 'sejal', 'christina', 'udayraj', 'anuj']

list of items after sorting ['anuj', 'bhumika', 'christina', 'sejal', 'udayraj']


17. WAP that takes the stage number from the user and prints the AI Project
Cycle stage name associated with the stage number. Like, for 3, it should print Data
Exploration.

CODE:
''' WAP that takes the stage number from the user and
prints the AI Project Cycle stage name associated with
the stage number. Like, for 3, it should print Data Exploration.'''

x=int(input("Enter the Stage no."))


stages=['Problem Scoping', 'Data Acquisition', 'Data
Exploration', 'Modeling', 'Evaluation']
print("Stage ", x, "is:", stages[x-1])

# Output:

Enter the Stage no.3


Stage 3 is: Data Exploration
18. Write a program to reverse the list elements.

# Code:
# write a program to reverse the list of elements.

marks=[98,95,96,100,99]
print(marks)
marks.sort(reverse=True)
print("the list in descending order")
print(marks)

#Output
[98, 95, 96, 100, 99]
the list in descending order
[100, 99, 98, 96, 95]
19. Write a program to accept two numbers and calculate their exponent.

Code :

'''write a program to accept two numbers and calculate their exponent'''

num=int(input("enter the number:"))

exp=int(input("enter the exponent:"))

result=num**exp

print("the exponent will be:",result)

# Output

enter the number:10

enter the exponent:3

the exponent will be: 1000


20. Write a program to create a list and remove the second element from the list.

'''20 Write a program to create a list and remove the second


element from the list'''

marks=[98,95,96,100,99]
print(marks)
marks.pop(1)
print("the list after remove the second element from the list")
print(marks)

# Output
[98, 95, 96, 100, 99]
the list after remove the second element from the list
[98, 96, 100, 99]

You might also like