From Barista to Pythonista: A Determined (but lazy) Programmer’s Guide to Acing the PCEP Certification Exam (Long)
Part 4 (Final) — Variables, Formatting and Modules
I hope prepping for the Python Institute PCEP exam has been going well for you and you’re not starting to see images like above in your sleep! In our final installment we’re going to take a deeper look into variables, formatting and modules to get you prepped for the exam. This is a big one so take your time and make sure you understand each section before you move on.
In Python, a variable is a name that refers to a value. Variables are used to store information that you can later access and manipulate. You can think of a variable as a label for a value.
For example, consider the following Python code:
message = "Hello, World!" print(message)
In this code, the variable message is assigned the string value “Hello, World!”. When the print() function is called, it prints the value of the message variable.
How do you create variables in Python?
To create a variable in Python, you need to give it a name and assign it a value. You can do this using the assignment operator =.