Phase 1 — Core Foundations
Printing & String Interpolation
print() instead of console.log(), and f-strings instead of template literals
Printing
JavaScript:
console.log('Hello');Python:
print("Hello")You can print multiple values at once, separated by commas:
name = "John"
age = 25
print(name, age)String interpolation
You'll use this constantly.
JavaScript:
const name = 'John';
console.log(`Hello ${name}`);Python:
name = "John"
print(f"Hello {name}")The f before the quotes means formatted string (an "f-string"). You can put more than
one value inside it:
name = "John"
age = 25
print(f"{name} is {age} years old")Think of it this way:
| JS/TS | Python |
|---|---|
Template literal `${x}` | f-string f"{x}" |