noknow.dev
Sign inSign up
Course overview
Python Fundamentals
0 / 6 lessons0%

Getting Started

  • Hello, World!
  • Variables and Types
  • Working with Strings

Decisions & Loops

  • if / elif / else
  • for Loops and range()

Functions

  • Writing Your Own Functions

Variables and Types

0m 00s

Variables in Python

In Python you don't need let or const — just write the name and assign the value:

name = "Alice"
age = 28
height = 1.72
is_student = True

print(name, age)  # Alice 28

Data types

print(type("Hello"))   # <class 'str'>
print(type(42))        # <class 'int'>
print(type(3.14))      # <class 'float'>
print(type(True))      # <class 'bool'>

f-strings (like template literals in JS)

name = "Max"
age = 30
print(f"My name is {name} and I am {age} years old.")
# Output: My name is Max and I am 30 years old.

Your task

Calculate the Body Mass Index (BMI):
BMI = weight (kg) / height (m)²

Use: weight = 75 kg, height = 1.80 m
Print: BMI: 23.15 (2 decimal places)

Back
pythonCtrl+Enter to run
Output

Click "Run" to execute your code.