7. Development basicsΒΆ

Programming languagesΒΆ

Please read and understand the following questions:

  • What’s the difference between a programming & scripting language?

  • What is a formal language, syntax, symantic?

  • What programming languages do you know?

  • Which difference will you get switching from one programming language to another?

Important

Take 30 minutes to research and answer the questions, then discuss them with your coach.

Install PythonΒΆ

As mentioned before, we’re making extensive use of Python, thus you need to have it installed on your operating system.

Head over to Python, download and install it.

Interactive Python shellΒΆ

In the Shell chapter, you already had your first contact with an interactive shell, most likely bash.

Now we’re doing the same, but instead of bash we’re using an interactive Python shell. The following command should open a Python shell respectively the Python interpreter:

python3

Now you should be able to do your first operation:

>>> print('Hello There')
Hello There

>>> 1 + 2
3

You can now leave the Python shell by typing exit() or pressing Ctrl-D.

First Python scriptΒΆ

You executed your first interactive Python command. Now let’s focus on your first Python script.

Let’s create a script which simply multiplies 2 numbers:

number1 = 6
number2 = 7

print('Result is:', number1 * number2)
  • Save that script in a new file called multiply.py

  • Open the shell and browse into the directory where the script is

  • Make sure the script is executable and interpreted by Python

  • Execute it

Hint

The output should look like this:

Result is: 42

Python principlesΒΆ

Now it’s time to learn Python.

Code combatΒΆ

When you’ve done the Python principles, head over to Code Combat and do this:

Note

If you want some change, feel free to switch between Code Combat & Learning Vi(m).