New Training: Interpret Python Scripts
In this 10-video skill, CBT Nuggets trainer Ben Finkel covers fundamental Python programming skills such as variables, looping, conditionals, functions, and classes. Watch this new Cisco training.
Learn Cisco networking automation with one of these courses:
This training includes:
53 minutes of training
You’ll learn these topics in this skill:
Interpreting Python Scripts
Understanding Python Variables
Working with Python Data Types
Understanding Python Lists and Dictionaries
Running Code Conditionally
Bundling Code into Functions
Using Parameters with Functions
Introduction to Classes in Python
Interpreting Python Scripts Summary
What are Python Variables?
Simple Python code can be written using data types and values that are exclusively literal or constant. However, when you move into more complex code, the program will need to change data as it executes, which is where variables come into play.
Python variables are essentially names attached to objects. The values of these variables don't need to be defined or declared in advance; they simply need to be identified. Creating a variable is a straightforward process: assign a value using the "=" symbol and then start using it. Whenever that variable is used in a statement or expression, its value will be substituted accordingly.
Many programming languages employ statically typed variables, which are initially assigned a specific data type that subsequently requires any value assigned to it during its existence to have the same data type. Python doesn't work this way, and a variable can be assigned one data type and later have it reassigned, providing a tremendous amount of flexibility to the programmer.