Challenge
Guard clauses
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…
Showing 11–14 of 14
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
…positions Indentation inside the loop, break and a first nested loop How it works 15 questions: 11 with one correct answer, 4 where you select every correct answer After each question you see the…
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…
Quiz
…<= 2000 and , or and not , and values that count as False Nested conditions and indentation Common mistakes, such as = instead of == How it works 15 questions: 11 with one correct answer, 4 where you…