Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära If/else Statements | Control Flow
Introduction to Data Analysis in Python

bookIf/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.

123456
price = 999 if price > 1000: print('The price is high. I won't buy it') else: print('OK, I will buy it')
copy
question mark

What will be printed after the code execution?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 2

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

Ställ mig frågor om detta ämne

Sammanfatta detta kapitel

Visa verkliga exempel

Awesome!

Completion rate improved to 2.7

bookIf/else Statements

Svep för att visa menyn

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.

123456
price = 999 if price > 1000: print('The price is high. I won't buy it') else: print('OK, I will buy it')
copy
question mark

What will be printed after the code execution?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 2
some-alt