0% found this document useful (0 votes)
5 views2 pages

Python Today Notes

The document covers the basics of Python operators, including types such as arithmetic, comparison, logical, assignment, membership, and identity. It explains logical operators (AND, OR, NOT) and comparison operators, along with their usage in conditional statements like IF, IF-ELSE, and ELIF. Examples are provided to illustrate how these operators and statements function in decision-making processes.

Uploaded by

Srikanth Bollam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Today Notes

The document covers the basics of Python operators, including types such as arithmetic, comparison, logical, assignment, membership, and identity. It explains logical operators (AND, OR, NOT) and comparison operators, along with their usage in conditional statements like IF, IF-ELSE, and ELIF. Examples are provided to illustrate how these operators and statements function in decision-making processes.

Uploaded by

Srikanth Bollam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Basics – Day Notes

1. Operators

Operators are symbols used to perform operations on values.

Types of Operators

Arithmetic, Comparison, Logical, Assignment, Membership, Identity

2. Logical Operators

Logical operators are used to combine conditions and return True or False.

AND Operator

Returns True only if both conditions are True.


marks = 80
attendance = 85

if marks >= 50 and attendance >= 75:


print('Eligible')

OR Operator

Returns True if at least one condition is True.


age = 16
with_parent = True

if age >= 18 or with_parent:


print('Allowed')

NOT Operator

Reverses the result. True becomes False and False becomes True.
is_logged_in = False

if not is_logged_in:
print('Please login')

3. Comparison Operators

Used to compare two values and return True or False.


print(10 > 5)
print(5 == 5)
4. Conditional Statements

Used to make decisions based on conditions.

IF Statement
age = 20
if age >= 18:
print('Adult')

IF-ELSE Statement
age = 16
if age >= 18:
print('Adult')
else:
print('Minor')

ELIF Statement
marks = 75
if marks >= 90:
print('A')
elif marks >= 50:
print('Pass')
else:
print('Fail')

You might also like