PYTHON BEGINNER NOTES
1. INTRODUCTION TO PYTHON
- Python is a high-level, interpreted programming language.
- Easy to read, write, and understand.
- Used for web development, AI, machine learning, automation, etc.
2. VARIABLES & DATA TYPES
- Variables store data.
Example:
x=5
name = "Sai"
Data Types:
- int, float, str, bool, list, tuple, dict
3. INPUT & OUTPUT
input() is used to get input from the user.
Example:
name = input("Enter your name: ")
print("Hello", name)
4. IF-ELSE CONDITIONS
Example:
age = 18
if age >= 18:
print("Adult")
else:
print("Minor")
5. LOOPS
For Loop:
for i in range(5):
print(i)
While Loop:
i=0
while i < 5:
print(i)
i += 1
6. FUNCTIONS
def greet(name):
print("Hello", name)
greet("Sai")
7. LISTS, TUPLES, DICTIONARIES
List: my_list = [1, 2, 3]
Tuple: my_tuple = (1, 2, 3)
Dictionary: my_dict = {"name": "Sai", "age": 18}
8. BASIC PROGRAM
Check even or odd:
num = int(input("Enter number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
9. PRACTICE QUESTIONS
- Print numbers from 1 to 10
- Find the largest of 3 numbers
- Reverse a string
- Count vowels in a word
- Write a calculator program
HAPPY CODING! :)