Q. In front of Python prompt, i.e., In [] prompt, type following expressions one by one, by pressing return key after every expression, e.g.,


NOTE :- In []: stands for input command and Out | stands for output here Python shows the output.

In[1] : 6*3
It will show output lines starting with Out[ ] :, e.g.:
Out [2] : 18

[Carefully notice, when you assign an expression to a name e.g., P = 2 + 3 in front of prompt In[ ], does Python display anything? When does Python display and when not?]


 
Expression Result (what Python returns)
1 6 * 3
2 3 ** 3
3 6 + 2 * 4
4 (6 + 2) * 4
5 5 - 3 - 3
6 k = 5 - (3 - 3)
7 9.0 ** 0.5
8 (5 + 3.1) * 5
9 S = 5.0 – (3 – 3.0)
10 S
11 x = 12.0 / 4
12 x
13 7 - -7 - -7
14 8 / 6
15 a = 8 % 3
16 a
17 3 ** 2 ** 0
18 (3 ** 2) ** 0
19 a + 5
20 3.0 * 0.5
21 9.0 % 3
22 -9.0 % 4
23 6.2 % 4
24 2 < 5
25 3 < 5 and 5 < 3
26 4 < 3 or 6 > 7
27 3 <= 3
28 4 != 5
Answer :-
 
Expression Result (what Python returns)
1 6 * 3 18
2 3 ** 3 27
3 6 + 2 * 4 14
4 (6 + 2) * 4 32
5 5 - 3 - 3 -1
6 k = 5 - (3 - 3) Python simply store the value of variable ‘k’.
7 9.0 ** 0.5 3.0
8 (5 + 3.1) * 5 40.5
9 S = 5.0 - (3 - 3.0) Python simply store the value of variable ‘S’.
10 S 5.0
11 x = 12.0 / 4 Python simply store the value of variable ‘x’.
12 x 3.0
13 7 - -7 - -7 21
14 8 / 6 1.3333333333333333
15 a = 8 % 3 Python simply store the value of variable ‘a’.
16 a 2
17 3 ** 2 ** 0 3
18 (3 ** 2) ** 0 1
19 a + 5 7
20 3.0 * 0.5 1.5
21 9.0 % 3 0.0
22 -9.0 % 4 3.0
23 6.2 % 4 2.2
24 2 < 5 True
25 3 < 5 and 5 < 3 False
26 4 < 3 or 6 > 7 False
27 3 <= 3 True
28 4 != 5 True

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post