python practical 11th cbse
python practical 11th cbse
Question Remarks
write a program in python to calculate in how many year you will be 100 years old.
write a program in python to calculate in which year you will be 100 years old.
write a program in python to calculate area and perimeter of rectangle . Enter by the
user.
write a program in python to calculate the area of circle.
Write a program in python to calculate area of triangle.
Write a program in python to calculate circumference of a circle.
Write a program in python to calculate profit,profit% or loss,loss%.
Write a program in python to check if a number is divisible by another number.
Write a program in python to calculate eligibility of vote according to age.
Write a program in python to check if a number is even or odd.
Write a program in python to calculate factorial of a number.
Write a program in python to calculate distance in meter ,cm,feet,inch.
Write a program in python to calculate time in minute hour and second.
Write a program in python to determine pass or fail.
Write a program in python to print table of number.
Write a program in python to calculate simple interest.
Write a program in python to print invoice of a product.
Write to program in python to calculate sum and percentage in 5 subjects.
Write a program in python to calculate tax on salary.
Write a program in python to convert temperature from faranhiet to Celsius.
Write a program to arrange no in ascending order.
Write a program in python to do all arithmetic operations on two numbers.
Write a program in python to calculate compound interest.
Write a program in python to calculate time from distance and speed.
Write a program in python to determine leap year or not a leap year.
Write a program in python to determine whether a number is positive , negative or
zero.
Write a program in python to calculate cube root of a number.
Write a program in python to calculate square root of a number.
Write a program in python to calculate square of a number.
Write a program in python to calculate cube of a number.
Write a program in python to print your name five times.
Write a program to check if all letters are uppercase.
Write a program in python to show how indexing works.
Write a program to show use of break keyword.
Write a program to show all keywords.
Q1 Write a program in python to calculate in how many year you will be 100 years old.
Code:
NAME=str(input('enter your name = '))
age=int(input('enter your age = '))
years=(100-age)
print('you will turn 100 years old in', years ,' years')
Sample Output:
Q2 write a program in python to calculate in which year you will be 100 years old.
Code:
year= (100-age)+2024
print('you will turn 100 in the year' , year)
Sample Output:
Q3 write a program in python to calculate area and perimeter of rectangle . Enter by the user.
Code:
area=l*b
print('area = ',area)
perimeter=2*(l+b)
print('perimeter = ',perimeter)
Sample Output:
pi=3.14
area=pi*a*a
print('area=',area)
Sample Output:
Q5 Write a program in python to calculate area of triangle.
Code:
a=(1/2)*b*h
print("Area:",a)
Sample Output:
Q6 Write a program in python to calculate circumference of a circle.
Code:
circumference=2*3.14*r
print('circumference = ',circumference)
Sample Output:
Q7 Write a program in python to calculate profit,profit% or loss,loss%.
Code:
CP=int(input('Cost Price'))
SP=int(input('Selling Price'))
Loss=CP-SP
Profit=SP-CP
Losspercent=(CP-SP)/(CP)*100
Profitpercent=(SP-CP)/(CP)*100
if (SP>CP):
print('Profit=',Profit)
print('Profit%=',Profitpercent)
elif(CP>SP):
print('Loss=',Loss)
print('Loss%=',Losspercent)
Sample Output:
Q8 Write a program in python to check if a number is divisible by another number.
Code:
if(x%y==0):
Sample Output:
Q9 Write a program in python to calculate eligibility of vote according to age.
Code:
if(age>=18):
else:
print('you cannot vote')
Sample Output:
Python Programs And their Output
Q10 Write a program in python to check if a number is even or odd.
Code:
print('even no')
else:
print('odd no')
Sample Output:
Python Programs And their Output
Q11 Write a program in python to calculate factorial of a number.
Code:
fact=1
for i in range(num):
fact=fact*(i+1)
print('factorial of ',num,' = ',fact)
Sample Output:
Python Programs And their Output
Q12 Write a program in python to calculate distance in meter ,cm,feet,inch.
Output:
Dis=int(input("Distance in km"))
meter=Dis*1000
feet=Dis*3280.84
inch=Dis*39370.1
cm=Dis*100000
print("distance in cm = ",cm)
Sample Output:
Python Programs And their Output
Q13 Write a program in python to calculate time in minute hour and second.
Code:
Time=int(input('Time in seconds'))
Hours=Time//3600
Minutes=Time//60
Seconds=Time%60
print('Hours=',Hours)
print('Minutes=',Minutes)
print('Seconds=',Seconds)
Sample output:
Python Programs And their Output
Q14 Write a program in python to determine pass or fail.
Code:
print('you passed')
else:
print('you failed')
Sample Output:
Python Programs And their Output
Q15 Write a program in python to print table of number.
Code:
Sample Output:
Python Programs And their Output
Q16 Write a program in python to calculate simple interest.
Code:
si=(p*r*t)/100
Sample Output:
Python Programs And their Output
Q17 Write a program in python to print invoice of a product.
Code:
cgst=SP*((gst/2)/100)
sgst=cgst
amount=SP+cgst+sgst
print('\t Invoice')
print('item:' , item)
print('price:' , SP)
print("CGST (@",(gst/2), "%): ",cgst)
Sample Output:
Python Programs And their Output
Q18 Write to program in python to calculate sum and percentage in 5 subjects.
Code:
percentage=(english+maths+cs+chemistry+physics)/500*100
print("sum = ",sum)
print("percentage = ",percentage)
Sample Question:
Python Programs And their Output
Q19 Write a program in python to calculate tax on salary.
Code:
tax =0.05*x
print('tax =',tax)
elif(x<=60000):
tax =0.06*x
print('tax =',tax)
elif(x<=70000):
tax =0.08*x
print('tax =',tax)
else:
tax =0.1*x
print('tax =',tax)
Sample Output:
Python Programs And their Output
Q20 Write a program in python to convert temperature from faranhiet to Celsius.
Code:
Faranhiet=int(input('Temprature in faranhiet = '))
Celcius=(Faranhiet-32)*5/9
print('Temprature In Celsius = ',Celcius)
Sample Output:
Python Programs And their Output
Q21 Write a program to arrange no in ascending order.
Code:
if(a>b>c):
print(c,b,a)
elif(a>c>b):
print(b,c,a)
elif(b>a>c):
print(c,a,b)
elif(b>c>a):
print(a,c,b)
elif(c>b>a):
print(a,b,c)
elif(c>a>b):
print(b,a,c)
Sample Output:
Python Programs And their Output
Q22 Write a program in python to do all arithmetic operations on two numbers.
Code:
a=int(input("first no-"))
b=int(input("second no-"))
sum=a+b
multiplication=a*b
subtract=a-b
division=a/b
mod=a%b
print("sum =",sum)
print("subtract =",subtract)
print("multiplication =",multiplication)
print("division =",division)
print("mod =",mod)
Sample output:
Code:
Python Programs And their Output
n = int(input('enter the amount: '))
for i in range(y):
n=n+((n*r)/100)
print("Final amount in ",i+1," years is: ",n)
Sample Output:
Python Programs And their Output
Q24 Write a program in python to calculate time from distance and speed.
Code:
t=d//s
m=((d/s)-t)*60
print('Time taken to cover ',d,' km is ',t,' hr ',m,' minutes ')
Sample Output:
Python Programs And their Output
Q25 Write a program in python to determine leap year or not a leap year.
Code:
print('leap year')
else:
Code:
print('positive number')
elif(I==0):
print('Zero')
else:
print('negative no')
Sample Output:
Python Programs And their Output
Q27 Write a program in python to calculate cube root of a number.
Code:
b=a**(1/3)
Sample Output:
Python Programs And their Output
Q28 Write a program in python to calculate square root of a number.
Code:
Sample Output:
Python Programs And their Output
Q29 Write a program in python to calculate square of a number.
Code:
b=a**2
Sample Output:
Python Programs And their Output
Q30 Write a program in python to calculate cube of a number.
Code:
b=a**3
Sample Output:
Python Programs And their Output
Q31 Write a program in python to print your name five times.
Code:
for i in range(5):
print("Nitish Sharma")
Sample Output:
Python Programs And their Output
Q32 Write a program to check if all letters are uppercase.
Code:
str=input('Enter a word: ')
a=str.isupper()
print(a)
Sample Output:
Python Programs And their Output
Q33 Write a program in python to show how indexing works.
Code:
list=[1,2]
print('Positive Index')
print(list[0])
print(list[1])
print('Negative Index')
print(list[-1])
print(list[-2])
Output:
Python Programs And their Output
Q34 Write a program to show use of break keyword.
Code:
for x in "Nitish":
if(x=="i"):
break
print(x)
Output:
Python Programs And their Output
Q35 Write a program to show all keywords.
Code:
import keyword
print(keyword.kwlist)
Sample Output: