Python Notes for Beginners
1. Introduction to Python
• Python is a high-level programming language.
• It is easy to learn and widely used.
• It is used in web development, data analysis, automation, AI, and testing.
2. Features of Python
• Simple and easy syntax.
• Interpreted language (no compilation required).
• Open source and free.
• Large community support.
3. Variables
• Variables store data values.
• Example: x = 10
• name = 'John'
4. Data Types
• int – Integer numbers (10, 20)
• float – Decimal numbers (10.5)
• string – Text ('Hello')
• list – Collection of items [1,2,3]
• dictionary – Key value pairs {'name':'John'}
5. Operators
• Arithmetic: + - * /
• Comparison: == != > <
• Logical: and, or, not
6. Conditional Statements
• Used to make decisions in code.
• Example:
• if x > 10: print('Greater')
• else: print('Smaller')
7. Loops
• For loop: used to repeat code.
• Example: for i in range(5): print(i)
• While loop: runs while condition is true.
8. Functions
• Functions are reusable blocks of code.
• Example:
• def greet(name):
• print('Hello', name)
9. Lists
• Lists store multiple items.
• Example: numbers = [1,2,3,4]
• Access item: numbers[0]
10. Basic Python Program
• print('Hello World')
• This is the first program most beginners write.