Welcome to this blog, where we will Learn to code Python from scratch. This blog will contain tutorials in the form of lessons, notes, and videos.
Learn to Code Python – Part 1 – Basics
📘 Section 1: What is Python and Programming?
💡 Programming
Programming means giving step-by-step instructions to a computer to perform a task — like telling a robot what to do.
💡 Python
Python is a simple and powerful programming language used in web development, data science, automation, and more.
⚙️ Section 2: Setting Up Python
✅ Step 1: Install Python
You need Python installed to write and run your code. Download it from python.org.
✅ Step 2: Install VS Code
VS Code is a code editor where you write Python scripts. It makes coding easier with suggestions, error checks, and a terminal.
🧠 Section 3: Python Basics
📌 Data Types
Python has different types of data, just like real life:
Type | Example | Python Name |
---|---|---|
Text | "hello" | str |
Number | 24 | int |
Decimal | 59.7 | float |
True/False | True or False | bool |
📌 Variables
Variables are containers to store data.
name = "Kunal"
age = 24
is_married = False
Think of a cup holding water – the cup is the variable, and the water is the data.
🧪 Section 4: Type, Input, and Conversion
📌 type()
Function
This shows what type of data a variable has.
print(type(name)) # str
print(type(age)) # int
📌 Getting User Input
We can ask users questions and store their answers.
name = input("What is your name? ")
🔁 Section 5: Data Conversion and F-Strings
📌 Type Conversion
Sometimes we need to change data from one type to another.
age = int(input("Enter your age: "))
📌 f-Strings
This is a cool way to write dynamic messages:
name = "Kunal"
age = 24
print(f"My name is {name} and I am {age} years old.")
🧮 Section 6: Lists and Operators
📌 Operators in Python
Operators are used to perform calculations:
Symbol | Meaning | Example |
---|---|---|
+ | Addition | 2 + 3 = 5 |
- | Subtraction | 5 - 2 = 3 |
* | Multiplication | 3 * 2 = 6 |
/ | Division | 6 / 3 = 2.0 |
// | Floor Division | 7 // 2 = 3 |
% | Modulus | 7 % 2 = 1 |
📌 Lists
A list is a collection that can store multiple values:
fruits = ["apple", "banana", "mango"]
print(fruits[0]) # apple
Lists can even store different data types.
🧠 Recap of What You’ve Learned in Part 1:
- What programming is and why Python is a great choice
- How to install Python and VS Code
- Variables and Data Types
- Checking data types using
type()
- Taking user input
- Converting data types
- Using f-strings for clean output
- Working with lists and operators
Learn to Code Python – Part 2 – Operators
Coming Soon