Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
56 views2 pages

I Puc Python Programs For Lab Exam 2004

Uploaded by

diganthcc449
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)
56 views2 pages

I Puc Python Programs For Lab Exam 2004

Uploaded by

diganthcc449
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
You are on page 1/ 2

I PUC PYTHON PROGRAMS FOR LAB EXAM 2004

01. Write a program to swap two numbers using third variable.


a=int(input(“Enter the value of a “))
b=int(input(“Enter the value of b”)) print(“The values Enter the value of a 40
before swapping”) print(“a=”,b,”b=”,b) temp=a a=b Enter the value of b
b=temp print(“The values after swapping”) 90 The values before
print(“a=”,b,”b=”,b) swapping a= 90 b= 90
The values after
swapping a= 40 b= 40
02. Write a program to enter two integers and perform all arithmetic operations.
a=int(input(“Enter first number”))
b=int(input(“Enter second number”)) Enter first number3
print(“The addition of two numbers=”,a+b) Enter second number5
print(“The difference of two numbers=”,a-b) The addition of two numbers= 8
print(“The product of two numbers=”,a*b) The difference of two numbers= -2
print(“The quotient of two numbers=”,a/b) The product of two numbers= 15
print(“The reminder of two numbers=”,a%b) The quotient of two numbers= 0.6
print(“The floor division of two numbers=”,a//b) The reminder of two numbers= 3
The floor division of two numbers= 0

03. Write a program to accept the length and breadth of rectangle and calculate its
perimeter and area.
Enter the length of recatangle10
l= float(input(“Enter the length of recatangle”)) Enter the breadth of recatangle20
b= float(input(“Enter the breadth of recatangle”)) Perimeter of rectangle= 60.0
perimeter=2*(l+b) Area of rectangle= 200.0
area=l*b
print(“Perimeter of rectangle=”,perimeter)
print(“Area of rectangle=”,area)

04. Write a program to calculate simple interest.


p=float(input(“Enter the principal amount”))
t=float(input(“Enter the time duration in years”)) Enter the principal amount 200000
r=float(input(“Enter the rate of interest per annum”)) Enter the time duration in years2
si=(p*t*r)/100 Enter the rate of interest per annum7
ap=p+si simple interest= 28000.0 amount
print(“simple interest=”,si) payable= 228000.0
print(“amount payable=”,ap)
05. Write a program to find largest among three numbers.

num1=int(input(“Enter first number”)) Enter first number7


num2=int(input(“Enter second number”)) Enter second number3
num3=int(input(“Enter third number”)) Enter third number4
large=num1 The largest among three numbers is= 7
if num2>large:
large=num2
if num3>large:
large=num3
print(“The largest among three numbers is=”,large)

06. Write a program that takes name and age f use and displays a message weather the
user is eligible to apply for driving license or not.
name=input(“Enter your name”) Enter your name: Deeksha
age=int(input(“Enter your age”) Enter your age17
if age>=18: Babitha sorry you are not eligible
print(name,”is eligible to spply driving license”)
else:
print(name,”sorry you are not eligible”)

12345
07. Write a program to print the pattern.
1234
row=5
123
for i in range(row,0,-1):
12
for j in range(1,i+1):
1
print(j,end=” “)
print()

08. Write a program to print multiplication table(COMMON PROGRAM TO WRITE)


def mul_table(number):
print("Multiplication Table for", number)
for i in range(1, 11):
result = number * i
print(number, "x", i, "=", result)
number = int(input("Enter the number: "))
mul_table(number)

You might also like