Python TutorialLesson 7Free preview
Python Variables
This lesson is part of Python · All levels
Summary
A variable is a name that refers to an object so that the value can be reused throughout the program. In Python, we just write names and then equals sign to give value, without having to declare the data type first. Because Python is dynamic, a variable can even be filled with different types of values at different times.
Key points
- The variable is created directly when it is first assigned a value with the operator =.
- No need to declare the data type because Python automatically determines it.
- The name of the variable should begin with a letter or underscore, not a number.
- The practice of naming snake_case in lowercase letters is recommended by PEP 8.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.