Professional Documents
Culture Documents
Chapter 197
5.
5. Write the output of the following
(a) num1 = 4
(b) num1, num2 = 2, 6
num2 =
num1 +11 num1, num2 = num2, num1 +2
num1 = 2
print(num1, num2)
print(num1, num2)
(c)
(C) num1, num2 2, 3 =
Ans.
X int(input("Enter value of x : "))
y int(input("Enter value of y: "))
z int(input("Enter value of z : "))
print("Individually, A, B and C take days respectively as " , x, y, z)
days (x*y*z)/(x*y + y*z +x*z)
print("Together A, B and C take days as:", days)
Sample run:
Enter value of x : 10
Enter value of y : 15
Enter value of z : 12
and a double quote without escape sequence in a single quoted string e.g., 'no."ltag'.
"xy
y" Size is 4. It is a nulti-line string create with \ in the basic string.
"Xy.I
multi-line EOL (J) character is also counted in size-
y" Sie is 5. Triple quoted string,
Solution.
)17.251 =0.17251x10 =
0.17251E02 (ii) 151.02 -0.15102 10 0.15102E0
(ii) 0.00031 =0.31x 10 =
0.31E-3 (io) 0.452 =0.0452 10 0.0452E0I
What is None literal in Python ?
Solution. Python has one special literal called None.
None None
and a statement in Python ?
11. What is the difference between an expression
Solution.
Expression Statement
Programming instruction as
per Python syntax
Legal combination of symbols
Does something
Represents something
Python executesit
Python evaluates it
Need not result in a value
End result is a value
Examples: print ("Hello")
Example: 2.3
(3+5)/ 4 i fa>3