DAY 3 OF PYTHON NOTES
DAY 3 OF PYTHON NOTES
๐น 1. Conditional Statements (if, elif, else)
✅ Basic Structure:
๐ Example:
๐น 2. Comparison Operators
Operator | Meaning |
---|---|
== | Equal to |
!= | Not equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal |
<= | Less than or equal |
๐น 3. Logical Operators
Operator | Meaning | Example |
---|---|---|
and | True if both conditions | a > 5 and a < 10 |
or | True if one is true | a < 5 or a > 15 |
not | Negates the condition | not(a == b) |
๐น 4. Practice Problems
-
Check if a number is even or odd.
-
Check if a number is positive, negative, or zero.
-
Find greater of two numbers.
๐น 5. Intro to Loops: while
Loop
✅ Syntax:
๐ Example:
Comments
Post a Comment