Challenge
Flatten nested ifs
Refactor a docking check built from three nested ifs into one condition joined with and, keeping the output exactly the same, then rewrite it as a flat if/elif chain that reports the first check that…
4 results
Challenge
Refactor a docking check built from three nested ifs into one condition joined with and, keeping the output exactly the same, then rewrite it as a flat if/elif chain that reports the first check that…
Quiz
…beginner quiz on Python if, elif and else: 15 questions on conditions, comparison and logical operators and indentation, with instant answers.
Challenge
Rewrite the four nested ifs in can_dock() as guard clauses that return a reason as soon as a check fails, keeping every answer the same, then add a new docking rule as one more guard with a default…
Quiz
…a function early with return : inside an if , a loop or nested loops Using a returned value straight away, and returning one of two values with a conditional expression How it works 15 questions: 11…