Python Practical Program List-2024-25
Python Practical Program List-2024-25
Program No:1 To print personal information like Name, Father’s Name, Class, Age, School
Name.
#To print personal information like Name, Father’s Name, Class, Age, School Name
Name=input("Enter Name:")
Age=int(input("Enter Age:"))
print(Name,FName,Class,Age,school)
print("\n")
print(Name)
print(FName)
print(Class)
print(Age)
print(school)
Output of the program
Enter Name: Syam
Enter Class:9
Enter Age:15
Syam
Mohan
15
* *****
** ****
*** ***
**** **
***** *
******
*****
****
***
**
*
Program No:5 To calculate Simple Interest if the principle amount = 2000 rate_of_interest = 4.5 time =
10
# Code to calculate the Simple Interest
principle_amount = 2000
roi = 4.5
time = 10
simple_interest = (principle_amount * roi * time)/100
print("Principle Amount : ", principle_amount)
print("Rate of Interest : ", roi)
print("Time Period : ", time)
print("Value of Simple Interest : ", simple_interest)
Output of the program
Principle Amount : 2000
Rate of Interest : 4.5
Time Period : 10
Value of Simple Interest : 900.0
LIST
Program No:11 Create a list in Python of children selected for science quiz with following
names- Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Perform the following tasks on the list in sequence-
○ Print the whole list
○ Delete the name “Vikram” from the list
○ Add the name “Jay” at the end
○ Remove the item which is at the second position.
# children = ["Arjun", "Sonakshi", "Vikram", "Sandhya", "Sonal", "Isha", "Kartik"]
# Create a list of children selected for science quiz with following
# names- Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Program No:13 Input a number and check if the number is positive, negative or zero and
display an appropriate message
# In this program, we input a number
# check if the number is positive or
# negative or zero and display an appropriate message
# This time we use nested if
num = float(input("Enter a number: "))
if num >= 0 :
if num == 0 :
print("Zero")
else:
print("Positive number")
else:
print("Negative number")
The output will be:
Output 1
Enter a number: 5
Positive number
Output 2
Enter a number: -1
Negative number
Output 3
Enter a number: 0
Zero
Program 15: Create a list List_1=[10,20,30,40]. Add the elements [14,15,12] using extend
function. Now sort the final list in ascending order and print it.
# Create a list List_1 with the elements 10, 20, 30, and 40
# Add the elements 14, 15, and 12 to List_1 using the extend function
List_1.extend([14, 15, 12])
print("The list after adding elements 14, 15, and 12 : ",List_1)
# Sort the final list in ascending order using the sort function
List_1.sort()
print("Final list after sorting in ascending order : ",List_1)