Before building powerful applications with Python, it's essential to understand the fundamentals. Week 1 lays the groundwork for your development journey:
- You’ll set up your tools like a professional developer.
- You’ll write your first Python code and start thinking like a programmer.
- You’ll learn the basic building blocks that every Python program uses.
Whether you're building web apps, analyzing data, or automating tasks, mastering Python basics is a non-negotiable first step.
Command Line Interface (CLI)
# Check Python version
python --version
# Navigate directories
cd ~/my-folder
# Copy file
cp file_1.txt file_2.txt
# Remove file
rm file_1.txt
# Create a new folder
mkdir new-folderGit & GitHub
# Initialize Git
git init
# Add files and commit
git add <file_name>
git commit -m "Initial commit"VSCode Tips
- Install Python extension
- Open Terminal in VSCode (Ctrl+) or (Ctrl`)
- Use IntelliSense for auto-completion - but not too much!
- Do not use any other AI-assist tools while learning
Hello World
print("Hello, world!")Comments
# This is a comment - it is ignored by the Python interpreterHow Python Thinks
- Top to bottom, left to right
- Indentation matters (4 spaces, not tabs)
- Readability counts!
Variables store values:
name = "Coder"
age = 30
is_student = TrueData Types
# String
message = "Hello"
# Integer
count = 10
# Float
price = 19.99
# Boolean
is_valid = FalseType Checking
print(type(name)) # <class 'str'>Dynamic Typing Python doesn't require you to declare variable types ahead of time.
-
What command checks your Python version in the CLI?
-
What symbol is used for comments in Python?
-
What is the data type of:
10.5? -
What is the output of
type("5")? -
True or False: Python uses curly braces for blocks of code.
-
Which of the following is a valid variable name?
Instructions:
Write a Python program that prints your full name to the screen using the print() function.
Learning Objective:
Practice writing your first line of Python code and get comfortable using the print() function to output text.
# TODO: Replace "Coder" with your name
print("My name is Coder")Instructions: Create two variables: one to store your name, and one to store your age. Then, print both variables in a single line.
Learning Objective:
Learn how to declare variables and output multiple values using print().
# TODO: Store your name and age in variables and print themInstructions:
Create two variables: length and width. Assign them numeric values. Calculate the area of the rectangle and print the result.
Learning Objective: Apply mathematical operations to variables and output the result.
# TODO: Change the values and calculate area = length × widthInstructions:
Create two variables, first and second, and assign them string values. Use string concatenation to combine them into one message.
Learning Objective: Understand string manipulation and how to join strings together.
# TODO: Replace with your own wordsInstructions:
Assign a value to a variable and use the type() function to check and print its data type.
Learning Objective: Learn how Python identifies different types of data (e.g., strings, integers, floats, booleans).
# TODO: Try different data types like True, "Hello", 99, 3.14Instructions:
Create a boolean variable called is_logged_in and set it to either True or False. Then use print() to display a message that includes the value of this variable.
Learning Objective: Understand and use boolean data types and simple logic.
# TODO: Set is_logged_in to either True or False- You installed your Python dev tools and learned how to use the CLI, Git, and VSCode.
- You wrote your first Python script and understood how Python executes code.
- You practiced declaring variables and using different data types (strings, numbers, booleans).
- You’ve started thinking like a software engineer by solving small problems programmatically.
- https://codingnomads.com/course/python-programming-101
- Section 1) Introduction
- Section 2) Learn Something New
- Section 3) Build Something
- Section 4) Set Up Your Machine
- Section 5) Introduction to Programming
- Section 6) Variables and Types
First:
- Create the Python Folder Structure
- Install the Python 101 Lab Exercises
Then, complete the following exercises: (in VSCode)
- 03_build-something -- all exercises
- 04_machine-setup -- all exercises
- 05_intro-to-programming -- all exercises
- 06_variables-and-types -- all exercises