Lesson 10.0
A class is a blueprint used to create objects:
class Hero:
pass
hero = Hero()
class declares a class, and its name is written with a capital letter: Hero, not hero;pass is a placeholder: an empty class has no body yet, but without it there is an error;Hero() with brackets creates an object from this blueprint;Hero and the
object hero are different things: one blueprint makes any number of parts.An empty object has no data of its own, so it prints as an address:
<__main__.Hero object at 0x...>.
The check gives the list of names names. Create one Hero object per name and print
<name>: hero created.
A class with an empty body is two lines: class Hero: and pass.
Then a loop over names: every step creates an object and prints a line.
An object is created with brackets: Hero().