Python Programming
Lab Report
Name: Parth Sharma
Roll No: PU02324EUGBTCS076
Date: August 2026
Page 1/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Table of Contents
1. Program 1: Arithmetic Mean and Pass/Fail Check
2. Program 2: Sum of Three Numbers - Positive/Negative/Zero
3. Program 3: Display Three Numbers in Ascending Order
4. Program 4: Even Numbers (1-50) and Odd Numbers (51-100)
5. Program 5: Sum of Even Numbers from 1 to 100
Page 2/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Program 1: Arithmetic Mean and Pass/Fail Check
Objective: A program that reads the grades of two tests, calculates the simple arithmetic mean, and informs
whether the student passed (average >= 6) or failed (average < 6).
Screenshot (Code & Output):
Source Code:
test1 = float(input("Enter the Marks of test1 :"))
test2 = float(input("Enter the Marks of test2 :"))
# PARTH SHARMA
#arithmetic mean
arithmatic = (test1 + test2)/2
print("average =",arithmatic)
#check pass or fail
if arithmatic >= 6 :
print("passed")
else:
print("failed")
Sample Output:
Enter the Marks of test1 :4
Enter the Marks of test2 :12
average = 8.0
passed
=== Code Execution Successful ===
Page 3/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Program 2: Sum of Three Numbers - Positive/Negative/Zero
Objective: A program that reads three numbers and checks if their sum is positive, negative or equal to zero.
Screenshot (Code & Output):
Source Code:
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
total = num1 + num2 + num3
print("Sum =", total)
if total > 0:
print("Sum is Positive")
elif total < 0:
print("Sum is Negative")
else:
print("Sum is Zero")
Sample Output:
Page 4/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Enter first number: -3
Enter second number: 5
Enter third number: -5
Sum = -3.0
Sum is Negative
=== Code Execution Successful ===
Page 5/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Program 3: Display Three Numbers in Ascending Order
Objective: A program that reads three numbers, and displays them on the screen in ascending order.
Screenshot (Code & Output):
Source Code:
#Display Three Numbers in Ascending Order
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
numbers = [num1, num2, num3]
[Link]()
print("Numbers in ascending order:")
for num in numbers:
print(num)
Sample Output:
Page 6/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Enter first number: 6
Enter second number: 4
Enter third number: 3
Numbers in ascending order:
3.0
4.0
6.0
=== Code Execution Successful ===
Page 7/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Program 4: Even Numbers (1-50) and Odd Numbers (51-100)
Objective: A program that displays even numbers from 1 to 50 and odd numbers from 51 to 100 using a
repeating loop.
Screenshot (Code & Output):
Source Code:
Page 8/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
#Display Even Numbers 1-50 and Odd Numbers 51-100#
print("Even numbers from 1 to 50:")
for i in range(1, 51):
if i % 2 == 0:
print(i)
print("Odd numbers from 51 to 100:")
for i in range(51, 101):
if i % 2 != 0:
print(i)
Sample Output:
Even numbers from 1 to 50:
2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50
Odd numbers from 51 to 100:
51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99
Page 9/10
Parth Sharma | PU02324EUGBTCS076 | Python Programming Report
Program 5: Sum of Even Numbers from 1 to 100
Objective: A program that calculates and displays the sum of even numbers from 1 to 100 using a repeating
loop.
Screenshot (Code & Output):
Source Code:
#Sum of Even Numbers from 1 to 100
total = 0
#PARTH SHARMA
for i in range(1, 101):
if i % 2 == 0:
total = total + i
print("Sum of even numbers from 1 to 100 =", total)
Sample Output:
Sum of even numbers from 1 to 100 = 2550
=== Code Execution Successful ===
Page 10/10