Python for Everybody: Learn Python from Scratch
About Lesson

Conditional Statements are if, elif, and else used for decision-making. Conditional statements help us make decisions based on certain conditions. The most common one is the if statement:

<code>

age = 18
if age >= 18:
print(“You are eligible to vote!”)
else:
print(“Sorry, you are not eligible to vote.”)

</code>

In this example:

  • If the age is greater than or equal to 18, it prints the eligibility message.
  • Otherwise, it prints the “not eligible” message.


Join the conversation