First day, first lesson, first thing

Hi, I just signed up for this because I want to learn about data analytics. This is the very first thing in the intro section.

"Exercise goal: Practice printing and manipulating numbers.

A Python interpreter is a convenient calculator!

So far, we have a variable called favorite_number.

Your job:

use Python to print the result of calculating favorite_number to the third power."

I have no idea what Python is or how to make it do anything. I don’t know how this is teaching me, it seems more like it’s asking me to do something that I have no knowledge of. Somebody help?

Is this an exercise in the Python track? If so, please post a link, if not, please tell us what you are using for an IDE (editor, interpreter, console).

Python is an interpreted language meaning it does not get pre-compiled before running, but interpreted and compiled at run time. It is a high level programming language which most readable languages are. Low level languages are ones that are nearly directly corresponding to the machine language of the computer.

Like all languages there is syntax which dictates how code statements may be composed but beyond that, the language is dumb and depends entirely on the programmer to dictate what the code will do. Our spoken language permits us to communicate but the language doesn’t do the communicating… we do. Programming is much the same.

Your first program might be…

print ("Hello world!")

Yes, that is a program. It takes a string literal which we authored and prints it to the console or other standard output device.

In many languages we denote power or exponentation with the ** operator. Think of this operator as a repeat multiplication operator, given that multiplication is done with the * operator.


print (3 ** 5)

This program will evaluate the mathematical expression, ,3 ** 5 and print the result to the display.

>>> print (3 * 5)     # multiply
>>> print (3 ** 5)    # raise to a power
1 Like