Interview Q&A / Python

BeginnerQuick answer1 min readUpdated 3 Oct 2026

Is Python statically or dynamically typed, and is it strongly or weakly typed?

SHORT ANSWER

Python is dynamically typed, because types are checked at runtime and a name can point to any object. It is also strongly typed, because it will not silently mix incompatible types, so "5" + 5 raises TypeError.

Explain it simply

Two separate ideas get mixed up here.

Dynamic typing: the type belongs to the value, not the variable. A name is a label you can stick on any object. In Java you declare int x; in Python, x can be an int now and a string later.

Strong typing: Python refuses to guess when types don't fit. JavaScript will turn "5" + 5 into "55"; Python stops with an error and makes you decide.

Example

python
x = 10
print(type(x))      # Output: <class 'int'>
x = "ten"
print(type(x))      # Output: <class 'str'>

try:
    print("5" + 5)
except TypeError as e:
    print("TypeError")   # Output: TypeError

print(int("5") + 5)      # Output: 10
print("5" * 3)           # Output: 555

What to say in the interview

"Python is dynamically and strongly typed. Type checking happens at runtime and variables are just names bound to objects. It's strong because there are no implicit conversions between unrelated types like str and int. Type hints are optional and only checked by external tools such as mypy."

Common mistakes

  • Saying "dynamic means weak". They are different axes.

#python#data-types

Related questions

Practise more Python questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Python quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.