Member-only story
Variables and Basic User Interaction in Python
When learning to program, the first set of operations you want to be able to complete are inputs, outputs, and storage of data. Almost every programming problem involves taking some form of input from a user, computing logic, then outputting some sort of end result to the user. The goal of this article is to introduce the syntax for these operations, and explain exactly what happens when we run them.
To start, we will look at simple outputs. To start off, we will learn how to print text to the screen using Python. Here are a few examples of print statements in Python:
There are a few key things to remember when printing output. print is a special function, which is designed to print text to the screen. When we put text in the brackets, we need to surround the text in quotes, so that Python understands that we are referencing text. If we were putting a number or variable in the brackets, we wouldn’t need the quotations, since the output is not text.
When we execute our program, the Python interpreter reads our code, and translates into code that our…