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
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Variables and Data Types | Python Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Python Fundamentals

Lesson 4 of 55

·Python

Variables and Data Types

20 minutes

Course progress7%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • Python’s dynamic typing infers the type from the value.
  • Common data types: int, float, str, bool, NoneType.
  • Use snake_case for identifiers; avoid reserved keywords.
  • `type()` reveals an object’s class at runtime.

Variables and Data Types

Python uses dynamic typing, which means you don’t need to declare a variable’s type upfront – the interpreter infers it from the assigned value. Common built‑in types include integers, floats, strings, booleans, and the special None value.

age = 30               # int
price = 19.99          # float
name = 'Alice'         # str
is_active = True      # bool
nothing = None        # NoneType

print(type(age), type(price), type(name), type(is_active), type(nothing))

Naming Conventions

  • Use snake_case for variable and function names (user_name).
  • Avoid Python keywords (class, def, if).
  • Constants are typically written in UPPER_SNAKE_CASE.

With variables under your belt, you can start storing and manipulating data.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Python FundamentalsBrowse activities
Previous lessonSetting Up the Development EnvironmentContinue to lesson 5Basic OperatorsBack to Python Fundamentals curriculum