r/PythonLearning • • Aug 18 '25

Day 2 - made this

Post image

Made this by myself (for the most part, made dumb errors here and there) after following Bro Codes Python guide for a bit.

177 Upvotes

44 comments sorted by

View all comments

5

u/Worried-Ad6403 Aug 18 '25

Good base. Now you can take this to the next level by adding these:

  1. Exception handling ( what if user enter incorrect input, your program will crash. Use try except )

  2. How do you force the user to provide a valid input always( Hint: Try except and while loop and break )

  3. How can you keep this program running infinitely unless the user wants to exit ( Use while loop and break )

You have to start developing the habit of making your code rock solid and crash proof. Always handle the edge cases. Always ask, during execution what could cause the program to crash. Always handle those edge cases. Then with this mindset, you’ll bring quality work to future bigger projects.

2

u/EasyTelevision6741 Aug 18 '25 edited Aug 18 '25

Just a minor thing that's bugging me here. His program will not crash if they enter an incorrect input. Unless of course we mean Ctrl C or similar.

It will simply print the else statement which I keep forgetting even though I've looked twice (damn reddit app and ADHD are such a shit combo).

Normally I wouldn't be asisine like this but feels important to use correct terminology so early on.

Edited to add: nevermind I totally whiffed and missed the internals of each case I was just seeing the outer case statement and not even reading inside them for some damn reason.

1

u/Sebasandrade00 Aug 18 '25

I think what he means is what happens if the user enters a string for the width/height inputs the program will crash

1

u/EasyTelevision6741 Aug 18 '25

Oh shit! Good call not sure how I blanked on those. That's why I should avoid trying to be helpful while half asleep.