Login using Social Account
     Continue with GoogleLogin using your credentials
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
Here John
is a string which is assigned to my_name
variable. Similarly 28
is a number which is assigned to variable age
. Variable pi
is assigned the value of 3.14
Pro Tip - =
is an assignment operator in Python. You can assign a value to a variable using =
operator
To print the value of a variable, we use print
statement. To print the value of my_name
and pi
, simply type below statement into a Jupyter notebook on the right-hand side and execute the cells.
print(my_name)
print(pi)
Use Jupyter notebook on the right-hand side to write code and complete this exercise
bank_balance
with the value 200
bank_balance
. It should print 200
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...