422,640 views
21 votes
21 votes
In the program below, which two variables have the same scope?

def usernameMaker (strFirst, strLast):
return strFirst + strLast[0]


def passwordMaker (strA, numC):
answer = dogName[0:3]
return answer + str(numC)

# the main part of your program that calls the function
username = usernameMaker ('Chris', 'Smith')
dogName = 'Sammy'
favoriteNumber = 7
password = passwordMaker (dogName,favoriteNumber)

User Rvandoni
by
3.0k points

1 Answer

16 votes
16 votes

Answer:

The answer would be dogName and favoriteNumber.
Both these variables are part of the global scope. That is, not inside of any function. Is that a satisfying answer?

User Chris Conover
by
2.9k points