#๐Ÿ”’ Error in terminal or code

24 messages ยท Page 1 of 1 (latest)

sullen ridge
#

Some pls help me i was writing a code and realised that somthing is wrong with my terminal (or code) please help

lone canopyBOT
#

@sullen ridge

Python help channel opened

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.

plucky hearth
#

I have no idea what you think is wrong with your terminal

#

can you explain it?

solemn bough
#

You're not actually running anything.

#

You need a main check like ```py
if name == 'main':
Student().talk()

sullen ridge
#

I have started learning python a few months ago

mild holly
solemn bough
#

It's common to have a main function

mild holly
sullen ridge
#

but..

#

In my book, it is not written

mild holly
#

what book

sullen ridge
#

I'm not taking any courses online so i study from a book

elder vessel
# sullen ridge In my book, it is not written

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

solemn bough
#

Your book may not include that part, potentially because it will cover it over the next few pages

sullen ridge
#

This is my book

solemn bough
#

Yes, it's mentioned on page 353

#

just no if __name__ == '__main__':

#

in fairness, it isn't required, just good practice

lone canopyBOT
#
Python help channel closed for inactivity

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.