Puzzle 1: Ready Player One

Let’s exercise our brain by solving a Python attribute lookup puzzle.

We'll cover the following

Guess the output

Try to guess the output of the code below:

class Player:
# Number of players in the Game
count = 0
def __init__(self, name):
self.name = name
self.count += 1
p1 = Player('Parzival')
print(Player.count)

Quiz- Puzzle 1

Q

What is the expected output of the above code?

A)

0

B)

1

C)

The code throws a TypeError exception.

D)

The code throws an AttributeError exception.