0% found this document useful (0 votes)
10 views6 pages

STD 9 Practical File 22-23

This document contains a series of programming exercises for Class 9, including tasks such as creating programs to display user input, manipulate lists, perform arithmetic operations, and check conditions. Each exercise includes source code and expected output. The exercises cover basic programming concepts using Python.

Uploaded by

sparshkoli27
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)
10 views6 pages

STD 9 Practical File 22-23

This document contains a series of programming exercises for Class 9, including tasks such as creating programs to display user input, manipulate lists, perform arithmetic operations, and check conditions. Each exercise includes source code and expected output. The exercises cover basic programming concepts using Python.

Uploaded by

sparshkoli27
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/ 6

Class 9 Practical File

1. Write a program that asks for your name and age, and then displays this on the screen.
Source code:
name = input("What is your name?:")
age=input("How old are you?:")
print("Your name is: "+name)
print("You are "+age+" years old")
Output:

---------------------------------------------------------------------------------------------------------------------------------------
2. Create a list with the following numbers. Delete the third number using the pop()
method.
10, 11, 12, 13, 14, 15, 16, 17
Source Code:
a=[1, 2, 3, 4, 5]
print(list)
a.pop(2)
print(list)
Output:

---------------------------------------------------------------------------------------------------------------------------------------

3. Input names of 5 friends and store them in a list.

Source code:
friends=[ ]
for i in range(5):
n=input("Enter friend Name:")
friends.append(n)
print(friends)
Output:
---------------------------------------------------------------------------------------------------------------------------------------

4. Write a program to accept three numbers from the user and add them.
Source Code:
number3=int(input("Enter number 1:"))
number2=int(input("Enter number 2:"))
number1=int(input("Enter number 3:"))
Sum=number1+number2+number3
print("The addition of three numbers are:",Sum)

Output:

---------------------------------------------------------------------------------------------------------------------------------------

5. Write a programme to find the quotient and remainder of two numbers .


Source code:
c = int(input("enter the first number:"))
d = int(input("enter the second number:"))
Q = c//d
R = c%d
print("Quotient is:",Q)
print("Remainder is:",R)

Output:

---------------------------------------------------------------------------------------------------------------------------------------
6. A program to check if the number is positive print an appropriate
message.

Source code:
num = float(input("Enter a number: "))
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
Output:
---------------------------------------------------------------------------------------------------------------------------------------

7. A program to check if a person can vote.

Source code:
age = int(input("enter age:"))
if age >=18:
print("Eligible for voting!")
else:
print("not eligible for voting!")
Output:

---------------------------------------------------------------------------------------------------------------------------------------

8. A program to calculate the area of a Circle having radius as 5.

Source code:
P = 3.14
R= 5
C= P*R*R
print("Area of a Circle is :", C)

Output:

---------------------------------------------------------------------------------------------------------------------------------------
9. A program to calculate average marks of 3 subjects.

Source code:
d = int(input("Enter the marks of first subject: "))
e = int(input("Enter the marks of second subject: "))
f = int(input("Enter the marks of third subject: "))
total = d+e+f
avg = total/3
print("Total marks: ",total)
print("Average marks: ",avg)

Output:
---------------------------------------------------------------------------------------------------------------------------------------
10. Create a list with the three items :
Cpu, Keyboard, Monitor-> Print the list->Add item mouse at the end of the list->print
the list

parts=["cpu", "keyboard", "monitor"]


print(parts)
parts.append("mouse")
print(parts)

---------------------------------------------------------------------------------------------------------------------------------------

11. Program for arranging the elements in a list.

Source code:
sports=["cricket","Football","Volleyball", "Kabbadi"]
print("list",sports)
sports.sort()
print("list in ascending order",sports)
sports.reverse()
print("list after reversal",sports)
sports.sort(reverse=False)
print("list after descending order",sports)

Output:

---------------------------------------------------------------------------------------------------------------------------------------
12. Write a program to find the area of a rectangle.
Source code:
L=float(input("Length:"))
B=float(input("Breadth:"))
Area=L * B
print("Area is", Area)
Output:
13. Create a list with [5,9,11,13,17 ] & print and check weather [10]
is an element in the list.

Source code:
a = [5,9,11,13,17]
if (9 in a):
print("Element exists")
else:
print("Element doesn't exists")
Output:

________________________________________________________________________

14. Enter your name and execute.

Source code:

b=input("Name: ")
print("Hello")
print(b)
Output:

________________________________________________________________________
15. Write a program to add two numbers.

Source code:

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


B = int(input("enter second number:"))
C=A+B
print("Addition of two numbers are:",C)
Output:

You might also like