0% found this document useful (0 votes)
9 views

Python 7 Notes

Uploaded by

bkaruna921
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)
9 views

Python 7 Notes

Uploaded by

bkaruna921
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/ 6

PYTHON Notes

Data types in PYTHON.


Programs
1. WAP to store 50 and 20 in two different variables. Now display their sum.
Sol→ X = 50
Y = 20
S=X+Y
print (“ The sum of 50 and 20 is “ , S)
2. WAP to store 68 and 49 in two variables. Find and display their difference
and product.
Sol→ A = 68
B = 49
D=A–B
P=A*B
print (“ The difference of 68 and 49 is “ , D)
print (“ The product of 68 and 49 is “ , P)

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”)

5. WAP to assign a number and check and display that it is divisible by 5 or


not.
Sol→ X = 39
if ( X % 5 == 0):
print ( “ The number divisible by 5 ”)
else:
print ( “The number is not divisible by 5”)
6. WAP to assign 3 angles and check and display that it forms a triangle or
not.
Sol→ X = 40
Y = 50
Z = 90
sum = X + Y + Z
if ( sum == 90):
print ( “ The triangle is posssible”)
else:
print ( “The triangle is not possible”)

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

You might also like