CMPSCI 119

Homework 6 Form
(Global Variables)


CMPSCI 119 Students, Current Semester, Only!

Please fill in the following form and click the submit button

UMass Spire ID Number
Enter your full name,
Last Name, First Name, MI, as in:
Smith, Fred Q.


HOMEWORK #6

Here are several functions that deal with global variables:


def Glop (P):
    global X
    P = P + 1
    X = P
    return

def Blort (Q):
    global X
    Glop (X+Q)
    return

def Snort (R):
    global X
    Blort (X-R)
    return  
			

Each of the following calls are done in order, and each depends on what has come before. What is the value of varaible X after each function is called? It is expected that you trace these problems manually, without help from Python, as you may see problems like this on the final exam.



1. Glop(5)
2. Blort(7)
3. Blort(7)
4. Snort(12)
5. Snort(40)
6. Glop(10)
7. Snort(20)
8. Snort(3)
9. Blort(-6)
10.Blort(-6)