Big Data with Spark - Flat 33% OFF Offer ends in
In the previous exercise, we have seen Python is a great calculator. In real-life when we write code, we use variables to define values so that we can reuse them again and again in our code.
A variable is a name that refers to a value. Let's see some examples.
my_name = "John" age = 28 pi = 3.14
John is a string which is assigned to
my_name variable. Similarly
28 is a number which is assigned to variable
pi is assigned the value of
Pro Tip -
= is an assignment operator in Python. You can assign a value to a variable using
To print the value of a variable, we use
pi, simply type below statement into a Jupyter notebook on the right-hand side and execute the cells.
Use Jupyter notebook on the right-hand side to write code and complete this exercise
bank_balancewith the value
bank_balance. It should print