Lesson 1 · Data analytics zero to hero
Python Variables & Data Types Explained | Data Analytics #1
Welcome to the first video in a full 30-part series taking you from zero to a job-ready data analyst, entirely in Python. This video covers the absolute…
- CourseData analytics zero to hero
- Lesson1 of 30
- Video13 min
- FormatJupyter notebook · 12 code cells
What you'll learn
Data
No separate download needed — the notebook creates or downloads everything it uses.
📓 Full notebook
Download .ipynbData Analytics Zero to Hero, Video 1: Variables, Data Types, and Operators#
- Welcome to the first video in a full 30-part series taking you from zero to a job-ready data analyst, entirely in Python.
- This video covers the absolute foundation: variables, the core data types, and the operators you'll use in every single video that follows.
- No prior programming experience needed. Let's jump straight in.
Before You Start#
- Install Python 3 from python.org (on Windows, check 'Add python.exe to PATH'), then install VS Code from code.visualstudio.com with its Python and Jupyter extensions.
- Open the Command Palette (Control/Command plus Shift plus P), run 'Create: New Jupyter Notebook', and select your Python interpreter as the kernel.
Part 1: Variables#
age = 28
print(age)
age = 29
print(age)
Naming Rules#
first_name = 'Ada'
last_name = 'Lovelace'
print(first_name, last_name)
Part 2: Core Data Types#
whole_number = 42
decimal_number = 3.14
text = 'Data Analytics'
is_active = True
print(type(whole_number))
print(type(decimal_number))
print(type(text))
print(type(is_active))
Converting Between Types#
price_text = '19.99'
price_number = float(price_text)
print(price_number)
print(price_number * 2)
print(str(price_number) + ' dollars')
age_text = str(29)
print(age_text, type(age_text))
Part 3: Arithmetic Operators#
a = 17
b = 5
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a // b)
print(a % b)
print(a ** 2)
Part 4: Comparison and Logical Operators#
x = 10
y = 20
print(x == y)
print(x != y)
print(x < y)
print(x >= 10)
has_ticket = True
has_id = False
print(has_ticket and has_id)
print(has_ticket or has_id)
print(not has_id)
Part 5: Formatting Output with f-strings#
name = 'Priya'
score = 87.456
print(f'{name} scored {score} points')
print(f'{name} scored {score:.1f} points')
revenue = 48213.7
print(f'Total revenue: ${revenue:,.2f}')
Wrap-Up: What You Learned#
- Variables: creating them, reassigning them, and Python's snake_case naming convention.
- The four core data types: int, float, str, and bool, plus converting between them.
- Arithmetic operators, including floor division and modulo.
- Comparison operators, which always return a bool, and the and/or/not logical operators.
- f-strings for embedding variables in text, with precise number formatting.
- Everything here is the vocabulary the rest of this 30-video series is written in. Subscribe so video two, on control flow, lands in your feed next see you there.
🧠 Test yourself
Pick an answer to check it. Your best score is saved in this browser.
What does
print(17 // 5)output?The
//operator is floor division: it divides and drops the decimal part, so 17 // 5 is 3.Which variable name follows Python's recommended naming style?
Python uses snake_case: lowercase words joined by underscores. Hyphens and leading digits are not allowed in names.
What type does
type(price_text)show forprice_text = '19.99'?Anything inside quotes is text (str), even if it looks like a number. You need float() to convert it.
What does this code print?
has_ticket = True has_id = False print(has_ticket or not has_id)
not has_idis True, andTrue or Trueis True.Given
revenue = 48213.7, what doesprint(f'{revenue:,.2f}')show?The
,adds thousands separators and.2fshows exactly two decimals, giving 48,213.70.
💻 Practice exercises
Try each one in the notebook or in your own editor before opening the solution.
Create variables
a = 17andb = 5. Print their sum, the result of normal division, floor division, and the remainder (modulo).💡 Hint
Use +, /, // and %.
✅ Show solution
a = 17 b = 5 print(a + b) # 22 print(a / b) # 3.4 print(a // b) # 3 print(a % b) # 2
Convert the text
'19.99'to a float, double it, and print a sentence using an f-string that shows the result with 2 decimals, likeDouble price: $39.98.💡 Hint
Use float() and a format spec like :.2f inside the f-string.
✅ Show solution
price_text = '19.99' price = float(price_text) # text -> number double = price * 2 print(f'Double price: ${double:.2f}')
Make variables
name = 'Priya',score = 87.456, andpassed = score >= 50. Print one line:Priya scored 87.5 points. Passed: Trueusing an f-string and rounding the score to 1 decimal.💡 Hint
Put the comparison in a variable first, then use {score:.1f} in the f-string.
✅ Show solution
name = 'Priya' score = 87.456 passed = score >= 50 # comparison gives a bool print(f'{name} scored {score:.1f} points. Passed: {passed}')
Found this useful?
All lessons, notebooks and datasets here are free. If they helped you, a coffee keeps new lessons coming.



