Python: Lists, KeyWords, Statements, Variables

Uncategorized
Wishlist Share
Share Course
Page Link
Share On Social Media

About Course

Let’s dive into each of these Python concepts:

  1. 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:
      • andasassertbreakclasscontinuedefelifelseforifimportinisnotorpassreturntrywhile, and with.
  2. 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 and myvar are different variables)
  3. 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).
Show More

Student Ratings & Reviews

No Review Yet
No Review Yet