Skip to content
dreamcode
dreamcode
Back to map
Nested checks · Lesson 7 of 44
+15 XP on finish
PYTHON BASICS

Indented checks

You can place if statements inside other if statements. This is called nesting. The inner check only runs if the outer check succeeds. You can also nest conditionals inside loops.

How it reads
if sky == "cloudy": checks the outer condition
if rain: checks the inner condition only when the outer is True
Cloud tip: Every level of nesting adds another 4 spaces of indentation. Keep nesting shallow so your code stays readable.
main.py
PYTHON
real Python, runs in your browser
CONSOLE
- run your code to see output -