teachinTech


Getting Started with Python

This activity will introduce you to Python and help you get your development environment set up.

Turn In: Screenshot of your development environment -- directions below

What is Python?

Python is a high-level, general purpose, interpreted programming language. What does that mean?

Programming language ... you write code following specific rules that the computer will understand. Usually the code you write has a purpose or task to accomplish. While Python is similar to other programming languages, it is unique and has its own specific set of instructions and ways to use those instructions.

Interpreted ... programming languages are usually either compiled or interpreted. Compiling takes the code and creates a program file that can be run. Interpreted languages run on the fly, interpreting one command or a group of commands at a time. Compiled programs often will run faster while interpreted languages have the benefit of being more convenient to run without having to compile then run the compiled program.

General purpose ... some programming languages are specific to certain tasks or certain industries. General purpose languages are suited to do a lot of different tasks in a lot of different industries. Python can be and is used for a lot of different things by a lot of people.

High-level ... programming languages are usually either low level or high level. Low level languages are often difficult to write and require a good understanding of the computer system the programming is running on. Some tasks are best done or need to be done in a low level language. High level languages work across different computer systems with little to no knowledge of the computer it is running on. High level languages are good to start with and are useful to quickly create programs.

Each programming language has strengths and weaknesses when compared with other programming languages. Python is an excellent choice of a language to start learning with and use to create some general purpose programs.

For a more detailed and formal document on "What is Python?", read through the link below (or you can search and find a lot of information) ...

What is Python? Executive Summary

Why Python?

Python is used by a number of univerities and high schools to teach programming and/or Computer Science. Many companies use Python to drive parts of their web site or for addressing problems that can be solved with computer programs. See the link below for some of organizations using Python.

Organizations Using Python

There are a lot of examples, add-on modules, and documentation on the Internet to help you learn Python and use Python for speciality tasks. Add-on modules provide additional functionality to Python that is not included in the base language. Often these add-ons are specialized computer programs that can expand the statements that Python understands and are often specific to tasks that are not considered general purpose. Someone along the way wrote and shared their code so others could be more productive when writing Python code.

Setting Up Your Development Environment

For this course, we are going to use the PyCharm Edu integrated development environment (IDE). This is a free program that makes coding in Python easier and quicker. As part of that install, it will also put on the general Python tools so they will be on your computer and available for you to use.

Go to ...

PyCharm Edu version

Click on "Get PyCharm Edu"

Make sure your OS is selected then click on Download

Save As to location of your choosing

Right click and Unblock

Double click to install

Next to start, Next for install directory, pick Python 3.x version and check Desktop shortcut if you want that, Install

Will download Python 3.x and go through the installation

Click Finish (can check to run it if you like)

Starting Up PyCharm Edu

Double click icon to start | Type ... in Start menu | Find JetBrains folder and start from there

Pick "I do not have a previous version of PyCharm or I do not want to import my settings" (unless you do have setting syou want to import)

Pick ... Introduction to Python

Interactive Python

By default, PyCharm installs Python to C:\Program Files\Python35

Navigate to that directory and double click on python.exe

You will see the Python interactive prompt ...

     >>>

At this prompt you can type Python commands and have them run.

For instance, type in ...

     5 + 3

... and hit Enter. It will display the number 8

To display a message on the screen, you use the print function as follows ...

     print("Hello World")

For help, you can type the help function ...

    help()

This puts you into the help utility and will stay there until you type quit or you press Ctrl-Z and hit Enter. Notice that the prompt changes from the three greater than signs to help>

While in help you can type a number of things to learn more about the Python language. Help is more of a reference for things you need more details about rather than a tutorial to learn the language. Type the word if to see information about the if statement. Type in keywords to see the list of keywords in the Python language.

Once done in help, type in quit and press Enter.

Once done in the interactive environment, type in quit() then press Enter.

Wrap Up

This is just the start of the Python learning experience.


Copyright © 2021 Eric Schumm. Permission granted to freely use this in your classroom.