Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 3 of 60 · python

Python Refresher: Variables, Data Types, and Control Flow

Duration: 20 minutes

Python Refresher

Even if you already know Python, a quick recap helps set the stage for data‑science‑specific code.

Variables and Data Types

# Numbers
x = 10          # int
y = 3.14        # float

# Strings
name = "Alice"

# Booleans
is_valid = True

# Collections
my_list = [1, 2, 3]
my_tuple = (1, 2, 3)
my_dict = {"id": 1, "value": 42}

Control Flow

# If‑else
if x > 5:
    print("big")
else:
    print("small")

# Loops
for i in range(5):
    print(i)

while x > 0:
    x -= 1

List comprehensions (the data‑science favorite)

squares = [i**2 for i in range(10)]

Info

Remember: Python is case‑sensitive.

Previous: Jupyter Notebook BasicsNext: Python Functions, Modules, and Packages