Professional Documents
Culture Documents
Assign Prompt Anything Python Display
Assign Prompt Anything Python Display
P = 2+3 in front of
[Caretully notice, when you assign an expression to e.g.,
a name
and
prompt In ]: does Python display anything ? When does Python display
when not ? ]
1. 6 3 15.
s3 16
62*4 17. 3 2 0
(6 2)*4 18 (3** 2) ** 0
5. 5 - 3 - 3
19 a+5
b. k 5 (3 -
7. 19.0** 0.5
21 9.8 %3
8. (5+3.1) 5
22.-9.0%4
9.
S 5.0-(3 -3.0) 23. 6.2 %4
10. S
24. 2 5
11. x = 12.0 4
25. 3 5 and 5 < 3
12.
26. 4 3 or 6> 7
13. 7 -7 - -7 27. 3 3
14. 8/6
28. 4 ! = 5
PROGRESS IN COMPUITR CIENCE
WITH PYI ON
(In | )displays its value r,g, when you dslgon a ahe or expreaalon uainM, Pytem
aimply does the asalg1nnient but doen not show anything
Inl ]: S-23
In[ :S renult of S diaplayed
23
In[ ]: S +3 result of expresion 8+ diaplayed
26
You can display values only in interactive mode ; to display anything through script
mode, you need to use print() command.
(Next PriP session 6.2 will make you practice print commands in script mode).
(i)
(ii)