Python 20 Questions and answers
Python 20 Questions and answers
Python's traditional runtime execution model: source code you type is translated to byte
code, which is then run by the Python Virtual Machine. Your code is automatically compiled,
but then it is interpreted.
print(add)
print(sub)
print(pro)
print(div)
52
28
480
3.3333333333333335
Integral expression : These are the kind of expressions that produce only integer results
after all computations and type conversions.
# Integral Expressions
a = 13
b = 12.0
c = a + int(b)
print(c)
Output
25
Logical expression : These are kinds of expressions that result in either True or False. It
basically specifies one or more conditions. For example, (10 == 9) is a condition if 10 is
equal to 9. As we know it is not correct, so it will return False.
Example :
P = (10 == 9)
Q = (7 > 5)
# Logical Expressions
R = P and Q
S = P or Q
T = not P
print(R)
print(S)
print(T)
Output
False
True
True