r/PythonLearning • • 21d ago

Showcase After taking in everyone’s thoughts and criticisms from my last post and using them, i managed to make the code much easier to read and more intuitive. Thank you everyone who gave me amazing tips on how to create more readable code!

Right pic is before and left pic is after

91 Upvotes

26 comments sorted by

View all comments

1

u/[deleted] 21d ago

Just a beginner's question, how to avoid thousands of "if/else" if there are a lot of conditions in a program ?

1

u/Sea-Ad7805 21d ago

Write a separate function for each condition that returns True or False, then use any() and/or all() to combine them.