Lesson 1 of 12 Β· 10 min Β· 1 hands-on step
Python Basics for JavaScript Developers
Variables, printing, f-strings and indentation, mapped to what you already know.
Why a second language?
Many junior roles list Python, and learning a second language proves you understand programming, not just one syntax. The concepts you already know transfer directly.
Side by side
| JavaScript | Python |
|---|---|
console.log("hi") |
print("hi") |
const name = "Ada" |
name = "Ada" |
`Hi ${name}` |
f"Hi {name}" |
true / false / null |
True / False / None |
&& / || / ! |
and / or / not |
// comment |
# comment |
Indentation is syntax
Python uses indentation (4 spaces) instead of curly braces:
Get the indentation wrong and you'll see IndentationError. Python is strict about it on purpose, so code always reads the same way.
Naming style
Python uses snake_case for variables and functions (total_price), while JavaScript uses camelCase (totalPrice). Following each language's conventions signals experience to reviewers.
π§ͺ Practice
Set name = "Ada" and years = 3, then print exactly:
Ada has been coding for 3 years
Use an f-string.
Output appears here. Press Run or Ctrl/β + Enter.
β Check your understanding
How does Python mark a block of code (like the body of an if)?
What is JavaScript's console.log in Python?
Create a free account to track your progress.