Python Notes (Class 10 AI – Code 417)
1. Introduction to Python
Python is a high-level, interpreted programming language used in AI and applications.
2. Tokens
Keywords: if, else, for, while
Identifiers: variable names
Literals: 10, "Hello"
Operators: +, -, *
3. Variables
Used to store data.
Example: x = 10
4. Data Types
int, float, str, bool
5. Input/Output
name = input("Enter name: ")
print(name)
6. Type Conversion
int(), float(), str()
7. Operators
Arithmetic: + - * / %
Relational: > < == !=
Logical: and, or, not
8. Conditional Statements
if condition:
statement
else:
statement
9. Loops
for loop and while loop
10. Functions
def add(a, b):
return a + b
11. Lists
nums = [1,2,3]
12. Important Programs
Even/Odd, Sum of n numbers, Factorial