Python 3 – Learn it quick – Introduction to Variables
Introduction to Variables
In this lesson, we are learning, how to declare a variable in python and how to print the values. In python, the command, print can be used to display the value of a variable.
Below given is an example on how to declare a variable, assigning a value and printing its value. In this example, you need to try declaring a variable with letter k, assign a value 10 to it and then print the value of k. You can use the below work space to do this exercise.
Lab Excercise
# Create a variable k, equal to 10
# Print out k
# This will get executed each time the exercise gets initialised
j = 15
# Create a variable k, equal to 10
k = 10
# Print out k
print(k)
test_object("k")
test_function("print")
success_msg("Great job!")
Use the assignment operator (
<-
) to create the variable k
.