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

Python Lab Record

The document outlines a series of Python programming experiments for Class 10, detailing the aim, algorithm, and coding for each experiment. It includes programs for basic arithmetic, eligibility checks, pattern printing, and data visualization using libraries like matplotlib. Each experiment requires completion of a date field and emphasizes testing and proper coding practices.

Uploaded by

sksuriyaa2010
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)
3 views7 pages

Python Lab Record

The document outlines a series of Python programming experiments for Class 10, detailing the aim, algorithm, and coding for each experiment. It includes programs for basic arithmetic, eligibility checks, pattern printing, and data visualization using libraries like matplotlib. Each experiment requires completion of a date field and emphasizes testing and proper coding practices.

Uploaded by

sksuriyaa2010
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

Python Lab Record - Class 10

Experiment No: 1
Date: ___________________

Program Name: Sum of Two Integers

Aim:
To write a program to calculate the sum of two integers.

Algorithm:
1. Start the program.
2. Input two integers from the user.
3. Add the two integers.
4. Display the sum.
5. Stop the program.

Program Coding:
a = int(input("Enter first integer: "))
b = int(input("Enter second integer: "))
s=a +b
print("Sum =", s)

Experiment No: 2
Date: ___________________
Program Name: Simple Interest

Aim:
To write a Python code to calculate simple interest.

Algorithm:
1. Start the program.
2. Input principal (P), rate of interest (R), and time in years (T).
3. Compute simple interest SI = (P × R × T) / 100.
4. Display the simple interest.
5. Stop the program.
Program Coding:
P = float(input("Enter principal: "))
R = float(input("Enter rate of interest: "))
T = float(input("Enter time in years: "))
SI = (P * R * T) / 100
print("Simple Interest =", SI)

Experiment No: 3
Date: ___________________
Program Name: Driving Licence Eligibility

Aim:
To check whether a user is eligible for a driving licence or not.

Algorithm:
1. Start the program.
2. Input the age of the user.
3. If age is greater than or equal to 18, print "Eligible for driving licence", otherwise print
"Not eligible for driving licence".
4. Stop the program.

Program Coding:
age = int(input("Enter your age: "))
if age >= 18:
print("Eligible for driving licence")
else:
print("Not eligible for driving licence")

Experiment No: 4
Date: ___________________

Program Name: Odd or Even Number

Aim:
To write a program that checks whether a given number is odd or even.

Algorithm:
1. Start the program.
2. Input an integer from the user.
3. If the number modulo 2 is 0, then print "Even number", otherwise print "Odd
number".
4. Stop the program.
Program Coding:
n = int(input("Enter a number: "))
if n % 2 == 0:
print("Even number")
else:
print("Odd number")

Experiment No: 5
Date: ___________________
Program Name: Display Even Numbers Between 10 to 20

Aim:
To code a program to display all even numbers between 10 and 20.

Algorithm:
1. Start the program.
2. Use a loop from 10 to 20 (inclusive).
3. For each number in the range, check if it is even.
4. If the number is even, display it.
5. Stop the program.

Program Coding:
for i in range(10, 21):
if i % 2 == 0:
print(i)

Experiment No: 6
Date: ___________________

Program Name: Palindrome Number

Aim:
To write a Python code to accept a number and display whether it is a palindrome or not.

Algorithm:
1. Start the program.
2. Input an integer from the user.
3. Store the original value in a variable.
4. Reverse the number using a loop.
5. If the reversed number equals the original number, print "Palindrome number",
otherwise print "Not a palindrome".
6. Stop the program.
Program Coding:
n = int(input("Enter a number: "))
temp = n
rev = 0
while n > 0:
digit = n % 10
rev = rev * 10 + digit
n //= 10
if rev == temp:
print("Palindrome number")
else:
print("Not a palindrome")

Experiment No: 7
Date: ___________________
Program Name: Print Pattern (4321, 432, 43, 4)

Aim:
To write a program to print the following pattern:

Algorithm:
1. Start the program.
2. Use an outer loop from 4 down to 1 for each row.
3. For each row i, use an inner loop from 4 down to i and print the numbers without
space.
4. Move to the next line after the inner loop completes.
5. Stop the program.

Program Coding:
for i in range(4, 0, -1):
for j in range(4, i - 1, -1):
print(j, end="")
print()

Experiment No: 8
Date: ___________________
Program Name: Time and Temperature Line Graph
Aim:
To write a code to make a straight line graph for time and temperature.

Algorithm:
1. Start the program and import [Link] as plt.
2. Store time labels in one list and corresponding temperature values in another list.
3. Plot a line graph using [Link]() with appropriate x and y values.
4. Add labels for x-axis (Time) and y-axis (Temperature °C), and a title.
5. Display the graph using [Link]().
6. Stop the program.

Program Coding:
import [Link] as plt
time = ["10 AM", "11 AM", "12 PM", "1 PM", "2 PM"]
temp = [30, 32, 34, 33, 31]

[Link](time, temp, marker="o")


[Link]("Time")
[Link]("Temperature (°C)")
[Link]("Time vs Temperature")
[Link]()

Experiment No: 9
Date: ___________________
Program Name: Bar Graph of 5 Subjects and Scores

Aim:
To write a Python program to make a bar graph of 5 subjects and their respective scores.

Algorithm:
1. Start the program and import [Link] as plt.
2. Store subject names in one list and their corresponding scores in another list.
3. Use [Link]() to create a bar graph with subjects on x-axis and scores on y-axis.
4. Add labels and a title to the graph.
5. Display the graph using [Link]().
6. Stop the program.

Program Coding:
import [Link] as plt

subjects = ["Maths", "Science", "English", "SS", "Tamil"]


scores = [85, 90, 78, 88, 95]
[Link](subjects, scores, color="skyblue")
[Link]("Subject")
[Link]("Score")
[Link]("Scores in 5 Subjects")
[Link]()

Experiment No: 10
Date: ___________________
Program Name: Scatter Plot of Height and Weight

Aim:
To create a scatter plot showing the relationship between height and weight of people.

Algorithm:
1. Start the program and import [Link] as plt.
2. Store height values in one list and weight values in another list.
3. Use [Link]() to create a scatter plot with height on x-axis and weight on y-axis.
4. Add labels for both axes and a title.
5. Display the graph using [Link]().
6. Stop the program.

Program Coding:
import [Link] as plt
height = [150, 165, 160, 175]
weight = [70, 55, 68, 50]
[Link](height, weight, color="red")
[Link]("Height (cm)")
[Link]("Weight (kg)")
[Link]("Height vs Weight")
[Link]()

Experiment No: 11
Date: ___________________

Program Name: Pie Chart of Monthly Expenses

Aim:
To create a pie chart showing the distribution of monthly expenses (rent, food, savings, and
transportation).
Algorithm:
1. Start the program and import [Link] as plt.
2. Store expense categories in one list and their corresponding percentages in another
list.
3. Use [Link]() to create a pie chart with labels and auto-calculated percentage display.
4. Add a title to the chart.
5. Display the chart using [Link]().
6. Stop the program.

Program Coding:
import [Link] as plt
labels = ["Rent", "Food", "Savings", "Transportation"]
values = [40, 25, 20, 15]

[Link](values, labels=labels, autopct="%1.0f%%")


[Link]("Monthly Expenses")
[Link]()

Notes:
Fill in the Date field for each experiment after completing it.
Ensure all Program Coding sections are tested and working correctly.
Use proper variable names and comments in your programs for better readability.
Make sure to run each program and verify the output before submitting.

You might also like