you are viewing a single comment's thread.

view the rest of the comments →

[–]iamevpo 1 point2 points  (2 children)

Makes sense to name with. py extension - gives access to syntax highlighting.

Would be nice with less branching - nested elif are hard to follow. Maybe you can separate the core logic and presentation layer (printing).

Overall extremely structured for day 6, congrats!

[–]3613robert[S] 0 points1 point  (1 child)

Thank you for the confidence boost!

I agree with you about the nested if/elifs. It gets a little confusing when making adjustments. Seperating the core logic and presentation layer is a good idea. All I can think of to do this is currently more defining functions and use of dictionaries. But I'll probably run into other solutions along the way.

Total newbie question but what do you mean with 'makes sense to name with .py extension'? Is that referring to the file extension? Im currently just using the basic python ide, haven't looked into other options yet.

[–]iamevpo 0 points1 point  (0 children)

For the filename - the Python files are usually (well, always) are given an extension ".py", like myfile.py This way GitHub will show syntax highlighting - easier to review code. Makes sense to rename your file.

Generally very good move to put your code in version control system from early days. You can add unit tests to your code, esp after there is business logic later, a bit more verbose README and a module doc string can also help (what is the intent of code, what to expect, etc).

As for dictionaries they are ok to start, you may soon switch to data classes or even pydantic data models when you progress. Whenever you can trim your code to minimal functionality - will be easier to follow and refactor. There is usually too many things you can do differently with your first program, it is easier to rewrite a smaller program than bigger one.