1
a = 10

class Car():
  global a
  print a

When I run this code, the value 10 gets printed. Why?

agold
  • 6,140
  • 9
  • 38
  • 54
Ramesh
  • 51
  • 1
  • 6

1 Answers1

0

When running a Python program, everything is executed, with the exception of functions. Try putting the code in class Car into a function.