Control Flow : if, elif, else
Kurnia Anwar Ra’if
A Highly-motivated Data Scientist
Senior Data & AI Platform - PT. Mastersystem Infotama Tbk
Data Scientist @ PT. KitaLulus International
Data Scientist @ PT. Sharing Vision– BRI Consultant
Software Engineering @ PT. AILIMA Geothermal
Mentor DS/BI/AI-ML - @ Dibimbing.id
Outline :
Control Flow
Conditional Statements (if, elif, else)
Summary :
- if: checks the first condition
- elif: checks additional conditions
- else: runs if none of the above conditions are true
These are essential for building decision-making logic in your Python programs.
The if statement checks whether a condition is True. If it is, the indented block of code under it will be executed.
elif (else if) Used to check another condition if the previous if condition was False. You can have multiple elif blocks.
The else block is executed when none of the previous conditions are True.
Hands on
Nested Conditions
Nested condition adalah conditional statement yang berada di dalam conditional statement lainnya.�Artinya, setelah suatu kondisi if bernilai True, di dalam blok tersebut kita bisa menambahkan kondisi if lagi untuk pengecekan tambahan.
Kapan digunakan nested condition?
Nested Conditions
Perlu diingat:
Hands on
Brief Assignment
Brief Assignment :
Thank you
https://www.linkedin.com/in/anwaraif/
kurniafreelancer@gmail.com