Question: What is the outpot of the following Python codes, Give brief explenation: (1) def myfunc(a): a = a + 2 a = a * 2

What is the outpot of the following Python codes, Give brief explenation:

(1)

def myfunc(a):

a = a + 2

a = a * 2

return a

print(myfunc(2))

(2)

rec={'Name':'Python', 'Age':20, 'Addr':'SK01', 'Country':'India'}

id1=id(rec)

del rec

rec={'Name':'C++', 'Age':40, 'Addr':'SK02', 'Country':'USA'}

id2=id(rec)

print(id1 == id2)

(3)

def Changer(P, Q=5):

P=P/Q

Q=P%Q

print (P, "#", Q)

return P

A=100

B=10

A=Changer(A, B)

print (A, "$", B)

B=Changer(B)

print (A, "$", B)

(4)

def DISPLAY(mystr):

L = len(mystr)

str2=' '

str3=' '

for i in range(0,L,1):

str2=str2+mystr[i]

for ch in str2:

if ch>='R' and ch<='U':

str3+='@'

elif ch.isupper():

str3+=ch

else:

str3+=ch.lower()

return str3

mystr="FiRST#tERM#ExAM"

mystr=DISPLAY(mystr)

print(mystr)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!