Question:

What Will Be The Output Of The Following Code Snippet?

def main():
    myCounter = Counter()
    num = 0
 
    for i in range(0, 100):
        increment(myCounter, num)
 
    print("myCounter.counter =", myCounter.counter, ", number of times =", num)
 
def increment(c, num):
    c.counter += 1
    num += 1
 
class Counter:
    def __init__(self):
        self.counter = 0
    
main()

 

Answers:


Keywords:

© 2017 QuizBucket.org