What the Comprehension Can See
class Deck:
ranks = [2, 3, 4]
doubled = [r * 2 for r in ranks]
class Deck2:
multiplier = 2
ranks = [2, 3, 4]
doubled = [r * multiplier for r in ranks]
One of these two class bodies raises NameError when the module is loaded. Which, and why?
Sign in to answer questions and track your progress
Sign In