Practical 1: Print "Hello, World!
"
print("Hello, World!")
Output
Hello, World!
Concept: First Python program using print().
Practical 2: Print Student Details
print("Name : Rahul")
print("Class : XI")
print("Roll No : 15")
print("School : ABC School")
Output
Name : Rahul
Class : XI
Roll No : 15
School : ABC School
Concept: Printing multiple lines.
Practical 3: Input Name and Display
Welcome Message
name = input("Enter your name: ")
print("Welcome", name)
Sample Output
Enter your name: Priya
Welcome Priya
Concept: input() function.
Practical 4: Add Two Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
sum = a + b
print("Sum =", sum)
Sample Output
Enter first number: 10
Enter second number: 20
Sum = 30
Concept: Arithmetic operator (+)
Practical 5: Calculate Area of Rectangle
length = float(input("Enter length: "))
breadth = float(input("Enter breadth: "))
area = length * breadth
print("Area =", area)
Output
Enter length: 12
Enter breadth: 5
Area = 60.0
Concept: Multiplication.
Practical 6: Swap Two Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Before Swapping")
print(a, b)
a, b = b, a
print("After Swapping")
print(a, b)
Concept: Multiple assignment.
Practical 7: Find Square and Cube
num = int(input("Enter a number: "))
print("Square =", num ** 2)
print("Cube =", num ** 3)
Output
Square = 49
Cube = 343
Concept: Exponent operator (**)
Practical 8: Find Simple Interest
p = float(input("Enter Principal: "))
r = float(input("Enter Rate: "))
t = float(input("Enter Time: "))
si = (p * r * t) / 100
print("Simple Interest =", si)
Formula
SI = P × R × T /100
Practical 9: Convert Celsius to Fahrenheit
c = float(input("Enter temperature in Celsius: "))
f = (9/5) * c + 32
print("Temperature in Fahrenheit =", f)
Formula
F = (9/5 × C) + 32
Practical 10: Convert Fahrenheit to Celsius
f = float(input("Enter temperature in Fahrenheit: "))
c = (f - 32) * 5 / 9
print("Temperature in Celsius =", c)
Practical 11: Find Average of Three
Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
average = (a + b + c) / 3
print("Average =", average)
Practical 12: Find Quotient and Remainder
a = int(input("Enter Dividend: "))
b = int(input("Enter Divisor: "))
print("Quotient =", a // b)
print("Remainder =", a % b)
Concept
// Integer Division
% Modulus
Practical 13: Calculate Percentage
m1 = int(input("Enter Marks 1: "))
m2 = int(input("Enter Marks 2: "))
m3 = int(input("Enter Marks 3: "))
m4 = int(input("Enter Marks 4: "))
m5 = int(input("Enter Marks 5: "))
total = m1 + m2 + m3 + m4 + m5
percentage = total / 5
print("Total =", total)
print("Percentage =", percentage)
Practical 14: Convert Minutes into Hours
minutes = int(input("Enter minutes: "))
hours = minutes / 60
print("Hours =", hours)
Practical 15: Find ASCII Value of a
Character
ch = input("Enter a character: ")
print("ASCII Value =", ord(ch))
Sample Output
Enter a character: A
ASCII Value = 65