If/else Statements
Decision making is required when we want to execute a code only if a certain condition is satisfied.
The if
, elif
, else
statement is used in Python for decision making.
123456price = 999 if price > 1000: print('The price is high. I won't buy it') else: print('OK, I will buy it')
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 2
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
Stel mij vragen over dit onderwerp
Vat dit hoofdstuk samen
Toon voorbeelden uit de praktijk
Awesome!
Completion rate improved to 2.7
If/else Statements
Veeg om het menu te tonen
Decision making is required when we want to execute a code only if a certain condition is satisfied.
The if
, elif
, else
statement is used in Python for decision making.
123456price = 999 if price > 1000: print('The price is high. I won't buy it') else: print('OK, I will buy it')
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 2