I use python

How many function calls occur when this code is run?

def A():
	B()
	C()
def B():
	C()
def C():
	return
	B()
A()



The second question is what is the value of x after this code is run?


x = 12
def A():
	global x
	x = 5
def B():
	x =7

A()
B()



The third question is what is the value of L after this code is run..?

L=[1,2,3]
def A():
       global L 
       L[1] =4
def B():
       L[2] =2
A()
B()





I'm going over my past final exam questions but when i try to run these codes on python, they print nothing.

Recommended Answers

All 3 Replies

Of course they print nothing. That's not what the questions are asking, is it.

No, that's not what the questions are asking.
The real questions are in my first post with the code


Of course they print nothing. That's not what the questions are asking, is it.

Then why don't you do the obvious thing and put print statements in each of those functions, run the example, and see how many things get printed. This hardly looks like rocket science.

commented: maybe he's dumb +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.