Check sibling questions

Find and write the output of the following Python code:

def Change(P ,Q=30):

P=P+Q

Q=P-Q

print( P,"#",Q)

return (P)

R=150

S=100

R=Change(R,S)

print(R,"#",S)

S=Change(S)

 

Answer:

The output of the given code is:

250 # 150

250 # 100

130 # 100

  1. Computer Science - Class 12
  2. Chapter 14 - Functions in python

About the Author

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo