#๐ Error in terminal or code
24 messages ยท Page 1 of 1 (latest)
@sullen ridge
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
You're not actually running anything.
You need a main check like ```py
if name == 'main':
Student().talk()
I have started learning python a few months ago
well not need but, its good practice
It's common to have a main function
cool, but what u think is wrong here (?)
It worked, thank you
but..
In my book, it is not written
what book
I'm not taking any courses online so i study from a book
It has to be written somewhere to make an object and run the method. Otherwise you're only declaring stuff.
Might be said earlier than this tho, when you learn functions - because that's the same concept, declaring function vs running it
Your book may not include that part, potentially because it will cover it over the next few pages
no it have not covered, I've checked
This is my book
Yes, it's mentioned on page 353
just no if __name__ == '__main__':
in fairness, it isn't required, just good practice
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.