#๐Ÿ”’ I need help on my assignment, theres this one question and i cant answer it

9 messages ยท Page 1 of 1 (latest)

echo hedge
#

this is the question:

  1. Allow a fellow student/designer to review your work. They must make their comments on this worksheet. You should write about:
    What you think works well in the program that has been made
    If any, what changes do you think could be made to improve the program.

this is the code:

cerulean stratusBOT
#

@echo hedge

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.

opal tide
#

i would

  • move everything under if __name__ == "__main__" into a main function
  • use type hinting and return types to make debugging and understanding the code easier
#

you could also add a seperate json file with stored questions that you add to the quiz on startup

echo hedge
#

ok ty

steep mist
#

Some other tips,

  1. You use magic variable names in some of your for loops (e.g. i and q). Change these to be readable variables names.
  2. You can reduce nesting in password checker. You donโ€™t need that first else as you break in the initial if statement.
  3. Using multiple print statements (one immediately after the other) when you can just use a single one can be expensive. You wonโ€™t notice it for this program but in future ones itโ€™s a better practice to combine them into a single print call. You can look into multi line strings to make it look nicer.
  4. You might want to add some docstrings to describe your methods.
cerulean stratusBOT
#
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.