10 Practical Term1 2022 23
10 Practical Term1 2022 23
3. Write a program to accept the roll and name of the student. Find out the total and average.
Print all the details of the student.
4. write a program to accept some amount of money which was withdrawn from bank and
find out how many 2000 rupees , 1000 rupees, 500 rupees, 100 rupee, 50 rupee 20 rupee
10 rupee 5 rupee , 2 rupee and 1 rupee notes are there.-10/5/2021
d=amt//1000
# finding the denomination
amt=amt%1000
print("the number of 1000 rupee notes are",d)
# find the remaining amount
print("amount left after deducing 2000 and 1000 notes",amt)
d=amt//500
amt=amt%500
print("the number of 500 rupee notes are",d)
print("amount left after deducing 2000 and 1000 notes",amt)
d=amt//100
amt=amt%100
print("the number of 100 rupee notes are",d)
print("amount left after deducing 2000 and 1000 notes",amt)
d=amt//50
amt=amt%50
print("the number of 50 rupee notes are",d)
print("amount left after deducing 2000 and 1000 ,50 notes",amt)
d=amt//10
amt=amt%10
print("the number of 10 rupee notes are",d)
print("amount left after deducing 2000 and 1000 ,50,10 notes",amt)
d=amt//5
amt=amt%5
print("the number of 5 rupee notes are",d)
print("amount left after deducing 2000 and 1000 ,50,10 ,5notes",amt)
d=amt//2
amt=amt%2
print("the number of 2 rupee notes are",d)
print("amount left after deducing 2000 and 1000 ,50,10 ,5notes,2",amt)
d=amt//1
amt=amt%1
print("the number of 1 rupee notes are",d)
print(amt,sep=" ",end=" ")
print("amount left after deducing 2000 and 1000 ,50,10 ,5notes,2,1",amt)
5. Write a program to find out that accepted number is divisible both by 5 and 7. If the
accepted number is divisible both by 5 and 7 then print the message yes it is divisible
both by 5 and 7 else print not divisible
7. Write a program to accept the sales made by a sales person. If sales are more than 40000 the
commission is 0.3 if commission is more than 30000 and less than 40000 the commission 0.2
and if sales less than 30000 the commission is 0.1. Calculate and print the sales and
commission.
sales=int(input("enter sales:"))
# checking the sales amount
if sales>=40000:
# calculating the commission
com=(sales*0.3)/100
elif sales>=30000 and sales<40000:
com=(sales*0.2)/100
elif sales<30000:
com=(sales*0.1)/100
print("the total amount of sales",sales)
print ("the commission the sales person got",com)
8. Write a program to accept the weight of a person. If weight is more than 80 print(“over
weight ” dear child do exercise and eat healthy everyday"). If weight is greater than 60
and less than 80 print the message "your weight ok but still put some effort to reduce"
other wise print the message "normal weight, but still you need to be excercise for good
health"
# accepting weight
weight=float(input("accept the weight of a person"))
# checking the weight to print proper message
if weight>=80:
print("over weight")
print("dear child do excercise and eat healthy everyday")
elif weight<80 and weight>=60:
print("your weight ok but still put some effort to reduce")
else:
if (weight <60 and weight>=50):
print("normal weight, but still you need to be excercise for good health")
else:
print("you have to gain some weight but excercise is mandatory for maintaining
good health")
9. Write a program to accept the units consumed by the user and calculate the user’s
electricity bill . if number of units consumed are less than 100 pay only rental amount . If
number of units is greater than 100 and less than 200 calculate the bill with Rs.2 /unit
+rent deducing first 100 units. If number of units consumed is greater than 200, charge
Rs.100 for first 100 units and Rs.200/- for next 100 units and pay Rs.3/unit - for rest of units.
units=int(input("enter no of units"))
rent=100
if units<=100:
bill=rent
elif units>100 and units<=200:
bill=((units-100)*2)+rent
elif units>200:
bill=((units-200)*3)+rent+200
print (bill)
10. Write a program to accept the employee id , name and basic salary. Calculate 20 percent
da on basic salary and 15% hra on basic salary. The travelling allowance is
Rs.2000/-.Calculate the gross salary as gs=bs+da+hra+ta. Find out the annual salary. If
annual salary is greater than 10 lakhs tax is gs*0.05 and assign “HIG” to category. If gs is
less than 1000000 and greater than equal to 500000 tax to be calculated as gs*0.02 and
assign “MIG” to category other wise tax is 0 and assign LIG to category. Print all the
details of the employee.
ns=asal-tax
print("employee id=",eid, "employee name=",enm,sep=" ")
print("basic salary=",bs,"dearness allowance=",da,\
"hourse rent allowance=",hra,"travelling allowance=",ta)
print("gross salary","\t","annual salary without deduction",'\t',"tax=","\t")
print(gs,"\t",asal," \t"," ",tax)
print("net salary","\t","category")
print(ns,"\t",category)
11. Write a program to find out number of odd numbers and number of even numbers within
the range which is accepted by the user.
12. Write a program to accept a number and find out whether it is a prime number or not.
for a in range(2,no+1):
if no%a==0:
count=count+1
if count==1:
print("prime no:")
else:
print("not prime no:")
OUTPUT
000
001
010
011
100
101
110
111
for i in range(0,2):
for j in range(0,2):
for k in range(0,2):
print(i,j,k,sep=" ")
OUTPUT
accept the no for which factorial you have to find :5
the factorial of a number 5 is= 120
15. Write a program to accept a number and find out whether it is an automorphic number or
not.
a=int(input("accept no:"))
sq=a*a
print("The square of the number",sq)
no=a
c=0
while(a>0):
a=a//10
c=c+1
if (sq%(10**(c))==no):
print("yes autmorphic number")
else:
print("NO not autmorphic number ")
OUTPUT:-
accept no:25
The square of the number 625
yes autmorphic number
Q2.
A
AB
ABC
ABCD
ABCDE
ABCDEF
17. Write a program to find out whether the accepted number is Armstrong number or not
print("armstrong")
else:
print("not armstrong")
OUTPUT
Accept the no:153
armstrong
18. Write a program to accept a number and find out whether accepted number is an evil
number or not .( an evil number is a non-negative integer that has an even number of
1s in its binary expansion. ... These numbers give the positions of the zero)
OUTPUT:-
accept the number8
not evil number
19. Write a program to generate the following Fibonacci series:
OUTPUT:-
printing fibonacci series
accept how many terms10
0&1,1, 2, 3, 5, 8, 13, 21, 34,
20. Write a program to print the sum of the values of the list
l=[10,20,30,40,50,60]
c=len(l)
sum=0
for i in range(c):
sum+=l[i]
print(sum)
OUTPUT
210