

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
Back
ctrl+,
Next
ctrl+.
Python is dynamically typed, which means a variable can store any type, and that type can change.
For example, if I make a number variable, I can later change that variable to a string:
speed = 5
speed = "five"
In almost all circumstances, it's a bad idea to change the type of a variable. The "proper" thing to do is to just create a new one. For example:
speed = 5
speed_description = "five"
Languages that aren't dynamically typed are statically typed, such as Go and Typescript (one of which you'll learn in a later course depending on your chosen track). In a statically typed language, if you try to assign a value to a variable of the wrong type, an error would crash the program.
If Python were statically typed, the first example from before wouldn't allow the second line, speed = "five". The computer would give an error along the lines of you can't assign a string value ("five") to a number variable (speed).
What kind of typing does Python employ?