How do I use (call) a variable in Python?

1) You must have invoked any variables you wish to use.

​

2) There are many different ways to "call" or use a variable. First look at the variable called story, it contains a story.

​

3) The variable is invoked, we now can do so many things with it. Lets print the story onto our screen.

​

4) To use or "call" the variable we must simple give the variable something to do. In this case if we write print() here we can make the variable print out.

​

5) We do NOT need to write the story over, that is inside the variable. So all we need to do is put the variable name in the print statement as pictured.

​

6) When we hit run, you can see on the right hand side that the story has printed out!

​

7) If I add another variable and also call it, It will add more!

​

8) Lets look at another example. I have 2 variables, number 1 and number 2.

​

9) If we simple use another print statement and then add the variable NAMES in the parenthesis, look at what happens.

​

10) We can add variables by name instead of numbers!

​

© 2020 Farragut Technology Program