0% found this document useful (0 votes)
12 views15 pages

Python Programs for Class XI-D 2024-25

The document is a Python programming assignment for Class XI-D, submitted by Rashmi Singh to Mr. Avnish Shukla. It includes a list of 17 programming tasks with source code and outputs, covering basic operations, area calculations, and conditional statements. Each task is dated and includes the student's identification information.

Uploaded by

annusingh5832414
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)
12 views15 pages

Python Programs for Class XI-D 2024-25

The document is a Python programming assignment for Class XI-D, submitted by Rashmi Singh to Mr. Avnish Shukla. It includes a list of 17 programming tasks with source code and outputs, covering basic operations, area calculations, and conditional statements. Each task is dated and includes the student's identification information.

Uploaded by

annusingh5832414
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

APEX PUBLIC SCHOOL

PYTHON FILE
CLASS XI-D
2024-2025

Submitted By: Submitted To:


Rashmi singh Mr. Avnish Shukla
Rno: 21 PGT IT
INDEX
[Link] Question Date Sign
1 WAP to Print Hello World 02.08.24
2 WAP to find the sum of two number 02.08.24
3 WAP to find the difference of two numbers 02.08.24
4 WAP find A raise to the power B when value of “A”and “B” 03.08.24
entered by users
5 WAP to find the area of triangle ? 03.08.24
6 WAP to swap the values of two variable 03.08.24
[i] using 3rd variable
[ii] without using 3rd variable
7 WAP to convert given minutes to hours and minutes
8 WAP of area of a rectangle?
9 WAP area of a circle ?
10 WAP to convert Celsius into Fahrenheit [( c*9\5) +32]
11 WAP to print the number upto n. 21.08.24
12 WAP to find the sum of all no. upto end. 21.08.24
13 WAP to check whether the entered number even or odd.
14 WAP to find the largest number out of 4 number entered by
users.
15 WAP to find the largest no. out of 2 number
16 WAP to calculate electricity bill with GST.
17 WAP to calculate division of 2 numbers

Q1. WAP To Print HELLO WORLD


Source Code
print(“Hello World”)
print(“Rashmi XI-D 21”)
Output

Hello world

Rashmi XI-D 21

Q2. WAP to find the sum of two number


Source Code

a=6
b=7
s=a+b
print("sum is:",s)
print(“Rashmi XI-D 21”)

OUTPUT

Sum is:13
Rashmi XI-D 21

Q3. WAP to find the difference of two numbers


Source Code

a=10
b=5
d=a-b
print(“difference is:,d)
print(“Rashmi XI-D 21”)

OUTPUT

Difference is: 5
Rashmi XI-D 21

Q4. WAP to find A raise to the power B when value of “A”and “B” entered by users
Source Code
a = int(input("Enter the value of a: "))
b = int(input("Enter the value of b: "))
print("a raise to the power b is : ", a ** b)
print('Rashmi XI-D 21')
OUTPUT

Enter the value of a: 2


Enter the value of b: 3
a raise to the power b is : 8
Rashmi XI-D 21

Q5 WAP to find the area of triangle


Source Code
a=int(input("enter the length of first side"))
b=int(input("enter the length of second side"))
c=int(input("enter the length of third side"))

p=(a+b+c)
s=p/2
area=(s*(s-a)*(s-b)*(s-c))
print("area of triangle is;",area)
print("perimeter of triangle is:",p)
print("semiperimeter of triangle is:",s)
print(“Rashmi XI-D 21”)

OUTPUT

Enter the length of first side5


Enter the length of second side6
Enter the length of third side7
Area of triangle is: 14.696938456699069
Perimeter of triangle is : 18
Semi perimeter of triangle is: 9.0
Rashmi XI-D 21

Q6. WAP to swap the values of two variable


[i] using 3rd variable
[ii] without using 3rd variable
Source Code
[i] using 3rd variable
a=3
b=5
print(“The value of A before swap is “,a)
print(“The value of B before swap is”,b)
c=b
b=a
a=c
print(“The value of A after swap is “,a)
print(“The value of B after swap is”,b)
print(“Rashmi XI-D 21”)

[ii] without using 3rd variable


a=5
b=6
a=int(input("enter a no"))
b=int(input("enter a another no"))
print("before swapping values are:",)
print("value of first variable a:",a)
print("value of second variable b:",b)
a,b=b,a
print("values after swapping are:",)
print("value of first variable:",a)
print("value of second variable:",b)
print(" Rashmi XI-D 21 ”)
OUTPUT

[i] The value of A before swap is 3


The value of B before swap is 5
The value of A after swap is 5
The value of B after swap is 3
Rashmi XI-D 21
[ii] enter a no 69
Enter a another no 65
Before swapping values are
Value of first variable a:69
Value of second variable b:65
Value after swaping are
Value of first variable :65
Value of second variable:69
Rashmi XI-D 21

Q7. WAP to convert given minutes to hours and minutes


Source Code
Time=int(input(“enter time in minutes”))
Hour=time//60
Minutes=time%60
Print(“hours is “,hour)
Print(“minutes is”, minutes)
print(“Rashmi XI-D 21”)

OUTPUT

Enter time in minutes 65


Hours is 1
Minutes is 5
Rashmi XI-D 21

Q8. WAP of area of a rectangle?


Source Code
L=int(input(“enter length of the rectangle :”))
b= int(input(“enter breadth of the rectangle :”))
area=l*b
print(“area of the rectangle is”,area)
print(“Rashmi XI-D 21”)

OUTPUT

Enter length of the rectangle : 10


Enter breadth of the rectangle : 5
Area of the rectangle is 50
Rashmi XI-D 21
Q9. WAP area of a circle
Source Code
r=int(input(“enter the radius of the circle :”))
a=3.14159265359*r**r
print(“area of the circle is “,a)
print(“Rashmi XI-D 21”)

OUTPUT

Enter the radius of the circle:4


Area of the circle is 804.24771931904
Rashmi XI-D 21

Q10. WAP to convert Celsius into Fahrenheit [( c*9\5) +32]


Source Code
c=int(input(“enter the temperature in celsius :”))
print(“Celsius in Fahrenheit is “, (c*9/5+32)
print(“Rashmi XI-D 21”)

OUTPUT

Enter the temperature in Celsius : 100


100 celsius in Fahrenheit is 212.0
Rashmi XI-D 21
Q11. WAP to print the number upto n.
Source Code
n=int(input(“enter a number :”))
i=1 while i<=n :
print(i)
i+=1
print(“Rashmi XI-D 21”)

OUTPUT

Enter a number:5
1
2
3
4
5

Rashmi XI-D 21

Q12. WAP to find the sum of all no. up to n.


Source Code
n=int(input(“enter a number :”))
i= 0 s=I while i<=n:
s+=i
i+=1
print(s)
print(“Rashmi XI-D 21”)

OUTPUT

Enter a number:5
15
Rashmi XI-D 21
Q13. WAP to check whether the entered number even or odd.
Source Code
nl=int(input(“enter a number :”))
if n1 % 2 = 0
print(n1, “ is even”)
else :
print(n1, “ is odd “)
print(“Rashmi XI-D 21”)

OUTPUT

Enter a number :5
5 is odd
Rashmi XI-D 21

Q14. WAP to find the largest number out of 4 number entered by users.
Source Code
n1 = int(input('Enter 1st number: '))
n2 = int(input('Enter 2nd number: '))
n3 = int(input('Enter 3rd number: '))
n4 = int(input('Enter 4th number: '))
if n1 > n2 and n1 > n3 and n1 > n4 :
print(n1, 'is the largest number')
elif n2 > n1 and n2 > n3 and n2 > n4 :
print(n2, 'is the largest number')
elif n3 > n1 and n3 > n2 and n3 < n4 :
print(n3, 'is the largest number')
else : print(n4, 'is the largest number')
print(“Rashmi XI-D 21”)

OUTPUT
Enter 1st number: 4
Enter 2nd number: 5
Enter 3rd number: 2
Enter 4th number: 9
9 is the largest number
Rashmi XI-D 21

Q15. WAP to find the largest no. out of 2number


Source Code
n1 = int(input('Enter first number: '))
n2 = int(input('Enter another number: '))
if n1 > n2 :
print('The largest number is ', n1)
else :
print('The largest number is ', n2)
print(“Rashmi XI-D 21”)

OUTPUT

Enter first number: 3


Enter another number: 5
The largest number is 5
Rashmi XI-D 21
Q16. WAP to calculate electricity bill with GST 12%.
Source Code
u = int(input('Enter the no. of units consumed: '))
if u <= 200 : b = 5 * u elif u <= 400 :
b = 1000 + 8 * (u - 200)
elif u > 400 :
b = 2600 + 10 * (u - 400)
B = b + (b * 12/100)
print('Total electricity bill (GST included) is ', B)
print(“Rashmi XI-D 21”)

OUTPUT

Enter the no. of units consumed: 500


Total electricity bill (GST included) is 4032.0
Rashmi XI-D 21
Q17. WAP to calculate division of 2 numbers.
Source Code
n1 = int(input('Enter the dividend: '))
n2 = int(input('Enter the divisor: '))
print(n1 , '/', n2, '=', n1/n2)
print(“Rashmi XI-D 21”)

OUTPUT

Enter the dividend: 15


Enter the divisor: 3
15 / 3 = 5.0
Rashmi XI-D 21

You might also like