Code Labs: Defensive Design

Master Authentication checks and Validation trap loops.

Interactive Engine

Test simple validation routines below. Try breaking it purposefully!

> Waiting to compile...

The Crucible

Prove your knowledge of authentication logic and validation boundaries.

Bronze (Authentication)

The Gatekeeper

Authentication just confirms identity. Usually utilizing a simple conditional check.

Task: Finish the if/else statement to only print "Access Granted!" if the provided password variable precisely equals "Dragon".

> Output will appear here...
Silver (Range Trap)

Trapping Outliers

A teenager account needs an age between 13 and 19 inclusive. We use `or` to check if they entered something outside that bound.

Task: Fix the missing while loop statement to correctly trap users who enter an age less than 13 OR greater than 19. E.g. while age < 13 or age > 19:

> Output will appear here...
Gold (Length Validation)

Impenetrable Defence

Passwords are strings. To check how many characters a string has, we wrap it in the len() command (e.g. len(password)).

Task: Create a full validation loop condition that keeps asking the user for a password as long as the length is strictly less than 8 characters.

> Output will appear here...