Skip to content

Untitled page

Here you go — I arranged everything cleanly in proper lab-record format so you can directly copy or rewrite neatly 👇

Python – ESCP-1

1) Write a program to perform arithmetic operations such as addition, subtraction, multiplication, and division based on user input

Program

# Arithmetic Operations Program

# Taking input from the user
num1 = float(input("Enter the first number: "))
num2 = float(input("Enter the second number: "))

# Performing arithmetic operations
addition = num1 + num2
subtraction = num1 - num2
multiplication = num1 * num2

# Handling division safely
if num2 != 0:
division = num1 / num2
else:
division = "Division by zero is not allowed"

# Displaying results
print("Results:")
print("Addition:", addition)
print("Subtraction:", subtraction)
print("Multiplication:", multiplication)
print("Division:", division)

Output

Enter the first number: 10
Enter the second number: 5

Results:
Addition: 15.0
Subtraction: 5.0
Multiplication: 50.0
Division: 2.0

2) Write a Python program to check if a number is positive, negative or zero

Program

num = float(input("Enter a number: "))

if num > 0:
print("The number is positive")
elif num < 0:
print("The number is negative")
else:
print("The number is zero")

Output

Enter a number: 7
The number is positive
If you want, I can also give you a perfect handwritten lab-record style layout (with Aim, Program, Output headings exactly like college record format). Just tell me 👍.
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.