Python 7 Notes
Python 7 Notes
3. WAP to assign the cost price and selling price of an article as Rs 4500 and
3200 respectively. Find and display the Loss and Loss percent.
Sol→ CP =4500
SP = 3200
Loss = CP – SP
LP = ( Loss * CP ) / 100
print (“ The Loss = Rs. “ , Loss)
print (“ The Loss % = “ , LP)
4. WAP to assign any numbers of your choice and check and display whether
it is an even or odd number.
Sol→ X = 39
if ( X % 2 == 0):
print ( “ The number is even”)
else:
print ( “The number is odd”)
7. WAP to assign any 2 angles and check and display whether they are
complementary angles or supplementary angles.
Sol→ X = 40
Y = 50
sum = X + Y
if ( sum == 90):
print ( “ Complimentary angles”)
else:
print ( “Supplementary angles”)
8. WAP to store a number and display the number is positive, negative or Zero.
Sol→ N = 40
if ( N > 0) :
print ( “ Positive Number”)
elif ( N < 0) :
print ( “Negative Number”)
else :
print (“Zero”)
9. WAP to assign 2 angles and check and display the proper message :
Sum Message
90 complementary
180 suplementary
Otherwise Neither complementary
nor supplementary
Sol→ X = 40
Y = 50
sum = X + Y
if ( sum == 90):
print ( “ Complimentary angles”)
elif ( sum == 180):
print ( “Supplementary angles”)
else :
print(“Neither complementary nor supplementary”)
10. WAP to assign an age of a person and check and display accordingly :
Age Message
below 13 Child
13-19 Teenager
20-59 Adult
60 and above Old
Sol→ A = 25
if ( A>0 and A<13):
print ( “ Child”)
elif ( A>=13 and A<=19):
print ( “Teenager”)
elif ( A>=20 and A<=59):
print ( “Adult”)
else
print(“Old”)
Convert the following expressions into python expression.
1. X = a + b – cd
Ans) X = a +b – c * d
𝐚+𝐛
2. 𝑺 = 𝐚𝐛
Ans) S = (a + b) / (a * b)
𝐯−𝐮
3. . 𝒇 = 𝐭
Ans) f = (v-u) / t
4. S = ut + ½ at2
Ans) S = u * t + (½) * a * t * t
5. a84 - b67
Ans) (a * * 84 ) – (b * * 67)
6. (a + b)2
Ans) (a + b) * * 2
7. a2 + b2 + 2ab
Ans) a * *2 + b * * 2 + 2 * a * b
8. A = PR2
Ans) A = P * R * * 2
9. P = 2(L + B)
Ans. P = 2 * ( L + B)
10 Circumference = 2R(3.14)
Ans) Circumference = 2 * R * (3.14)
Evaluate:
a. 2 + 3 – 4 * 1
=5–4
=1
b. 5 + 6 % 2 -3 ** 2
= 5+0–9
= -4
c. 6 + 3/2 * * 2 – 3 % 2 + 1
= 6+3/4-1+1
= 6+0–1+1
= 6
d. 2 + (2 -3) * 4 % 2 * * 3
= 2–1*4% 8
= 2–1*4
= -2