Python Beginner Notes
What is Python?
Python is a friendly and powerful programming language used for web development,
AI, automation, data analysis, and more.
1. print()
Use print() to display text on the screen.
Example: print("Hello!")
• Text must be inside quotes.
• print must be lowercase.
• Every opening parenthesis ( needs a closing ).
2. Strings
A string is text inside single (' ') or double (" ") quotes.
Example: "Hello" or 'Hello'.
Use the opposite quote if your text contains an apostrophe: "It's a great day!".
3. Comments
Comments are notes for humans and are ignored by Python.
Start a comment with #.
4. Variables
A variable stores data.
Example: name = "Alice"
Rules:
• Can contain letters, numbers, and underscores (_).
• Cannot start with a number.
• Python is case-sensitive (age ≠ Age).
• Values can be changed anytime.
5. Numbers
Integer (int): Whole numbers (5, -10).
Float: Decimal numbers (3.14, 1.5).
Numbers do not need quotes.
6. Math Operators
+ Add - Subtract * Multiply / Divide
% Modulo (remainder)
** Exponent (power)
// Floor division (removes decimal part).
/ always returns a float.
7. len()
Use len() to count the number of characters in a string.
Example: len("Hi") = 2
An empty string "" has a length of 0.
Key Points to Remember
• print() displays output.
• Strings need quotes.
• Numbers do not need quotes.
• Variables store data.
• Python is case-sensitive.
• / returns a float, % gives the remainder, ** raises a number to a power, and //
performs floor division.