P,Q=45,90
print(P,"#",Q)
P,Q=Q,P
print(P,"#",Q)
the output of the above is?
Answers
Given cσde:
>>> P, Q = 45, 90
>>> print(P, "#", Q)
>>> P, Q = Q, P
>>> print(P, "#", Q)
Output:
For print statement #1:
- 45 # 90
For print statement #2:
- 90 # 45
Explanation:
>>> P, Q = 45, 90
#assigning values 45 to P and 90 to Q
>>> print(P, "#", Q)
#printing the values of P and Q separated by a hash
>>> P, Q = Q, P
#swapping the values of P and Q; Q's value is stored in P and P's value is stored in Q
>>> print(P, "#", Q)
#printing the values of P and Q separated by a hash
>>> P, Q = 45, 90
>>> print(P, "#", Q)
>>> P, Q = Q, P
>>> print(P, "#", Q)
Output:
For print statement #1:
45 # 90
For print statement #2:
90 # 45
Explanations:
>>> P, Q = 45, 90
#assigning values 45 to P and 90 to Q
>>> print(P, "#", Q)
#printing the values of P and Q separated by a hash
>>> P, Q = Q, P
#swapping the values of P and Q; Q's value is stored in P and P's value is stored in Q
>>> print(P, "#", Q)
#printing the values of P and Q separated by a hash