Course Overview

/

Python Variables

Script Variables

In scripting languages, a variable is a named storage location in memory that is used to hold a value. The value of a variable can be assigned, modified, and accessed during the execution of a program.

This is useful as it allows more complex processes to be incorporated into our script and allows data to be called in different areas of the script.

In Python it is possible to define variables throughout the script. This can be done by declaring a variable name and assigning it a value

Once a variable has been defined, it can be used throughout the script.

2nd Python Script

The second Python script created is:

This is used to demonstrate that it is possible to print variable values to the terminal with the “print” command. It is also possible to conduct mathematical operations within print commands while using variables.

There are 2 different methods used in this script to print an output sentence that includes variable values.