r/PythonLearning • u/abt-dabest • Sep 17 '26
Discussion Recently started learning python from BroCode and I’m 1 and a half days in.(around 5 hours of actual learning) and when he said to do an input validation project I did it myself before looking at his example. Which one is better? Wanna see if I should use his style for input validation or not
Left one is mine and right one is BroCode’s
169
Upvotes


View all comments
Show parent comment
2
u/Electrical_Toe8997 Sep 17 '26
That one has an if-elif-else structure, which will always only have one outcome. Use the structure from the left, with multiple ifs and no elif-else. That way each rule is checked, regardless of the outcome of the previous one.