0

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.
3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by BestJewSinceJC
0

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.

2

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.

Votes + Comments
maybe he's dumb
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.