ACTIVITY 40 / 50
Try as many times as you needBuild from the blueprint
Let’s understand
Calling a class creates an instance: a separate object. bot = Robot() creates one robot. Use a dot to read and write its data: bot.name. Different objects can hold different values.
Listen to the explanation
Example
class Box:
pass
b = Box()
b.color = "blue"
print(b.color)Create bot from Robot. Set bot.name to Veda and print it.
I need a hint
Robot() creates the object; bot.name stores its name.
How to find an error
- Read the last line of the error message.
- Find the indicated line. Check quotes, parentheses and indentation.
- Change one thing and run again.
main.py
4 spaces
Your draft stays in this browser.
Result
PythonYour program’s output will appear here. Click Run.
Мой профиль