Python: Lists, KeyWords, Statements, Variables
About Course
Let’s dive into each of these Python concepts:
- Keywords:
- Python has a set of reserved words called keywords that cannot be used as variable names, function names, or any other identifiers. These keywords serve specific purposes in the language.
- Some common Python keywords include:
and
,as
,assert
,break
,class
,continue
,def
,elif
,else
,for
,if
,import
,in
,is
,not
,or
,pass
,return
,try
,while
, andwith
.
- Variables:
- Variables are used to store data in Python. They act as named containers for values.
- To create a variable, you simply assign a value to a name. For example:
Python
Variable names must follow certain rules:
- They can contain letters (both uppercase and lowercase), digits, and underscores.
- They cannot start with a digit.
- They are case-sensitive (e.g.,
myVar
andmyvar
are different variables)
- Lists:
- Lists are used to store multiple items in a single variable. They are one of the built-in data types in Python.
- To create a list, use square brackets:
Python
my_list = [1, 2, 3, 4, 5]
- Lists can hold different data types (e.g., numbers, strings, other lists).
Student Ratings & Reviews
No Review Yet