Interview Question

What are conditional statements?

if, elif, and else select blocks using truth-value tests.

💡 Concept ✅ Quick Revision 🐍 Python

Answer

Conditional statements choose which block to execute based on truth-value testing. • `if` starts the decision and `elif` adds alternatives. • `else` handles the remaining case. • Indentation defines each controlled block.

💡 Simple Example

score = 82 if score >= 90: grade = 'A' elif score >= 75: grade = 'B' else: grade = 'C' print(grade)

Output

B

⚡ Quick Revision

if, elif, and else select blocks using truth-value tests.