Computer Science - Class 12
Chapter 14 - Functions in python

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:

Question1-Find and write the output - Teachoo.jpg

The output of the given code is:

250 # 150

250 # 100

130 # 100

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

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, Social Science, Physics, Chemistry, Computer Science at Teachoo.