Programming fundamentalsLesson 2 of 7 in the course Decisions
Python If and If-Else: Conditions, Branches, and Indentation
5 flashcards · 4 quiz questions · 5 match pairs · 5 fill-in sentences · English
Lesson progress
0 / 5
Your progress is kept in this browser only.Sign up to save it
Summary
Programs often need to choose what to do based on information, just as people decide whether to take an umbrella depending on the weather. In this lesson, you will learn how Python uses if and if-else statements to make decisions.
A condition is an expression that evaluates to either True or False. An if statement uses a condition to decide whether its indented body of statements should run.
All flashcards
Quiz questions
Based on Introduction to Python Programming by Udayan Das, Aubrey Lawson, Chris Mayfield, Narges Norouzi (OpenStax), licensed CC BY 4.0. Adapted into a summary, flashcards and quizzes.
More in Programming fundamentals
All Programming fundamentals lessonsProgramming fundamentalsTracing Conditional and Function-Call Control Flow5 flashcards · 5 quiz questions · 4 gamesPlay free →Programming fundamentalsWhile Loops: Conditions, Counters, and Input-Controlled Repetition5 flashcards · 5 quiz questions · 4 gamesPlay free →Programming fundamentalsPython Function Parameters, Arguments, and Mutable Inputs5 flashcards · 4 quiz questions · 4 gamesPlay free →Programming fundamentalsPython Loop else: Normal Completion and break5 flashcards · 4 quiz questions · 4 gamesPlay free →Programming fundamentalsVariable Scope: Global and Local Variables in Python5 flashcards · 5 quiz questions · 4 gamesPlay free →Programming fundamentalsPython Function Arguments, Defaults, and PEP 8 Spacing5 flashcards · 5 quiz questions · 4 gamesPlay free →