You are on page 1of 2

Variable Definitions in Python

The most basic building-block of any programming language is


the concept of a variable, a name and place in memory that we
reserve for a value.

In Python, we use this syntax to create a variable and assign a


value to this variable:

<var_name> = <value>
For example:

age = 56
name = "Nora"
color = "Blue"
grades = [67, 100, 87, 56]
If the name of a variable has more than one word, then the Style
Guide for Python Code recommends separating words with an
underscore "as necessary to improve readability."
For example:

my_list = [1, 2, 3, 4, 5]
💡 Tip: The Style Guide for Python Code (PEP 8) has great
suggestions that you should follow to write clean Python code.
🔸 Hello, World! Program in Python
Before we start diving into the data types and data structures
that you can use in Python, let's see how you can write your first
Python program.

You just need to call the print() function and write "Hello,


World!" within parentheses:
print("Hello, World!")
You will see this message after running the program:
"Hello, World!"

You might also like