Home » Computer Science Courses » Programming » Python » Python Programming
Python By Example Getting up and running

Python Programming

Learn Python Programming

What is Python?

Python is an object-oriented programming language created by Guido Rossum in 1989. It is ideally designed for rapid prototyping of complex applications. It has interfaces to many OS system calls and libraries and is extensible to C or C++. Many large companies use the Python programming language include NASA, Google, YouTube, BitTorrent, etc.

Python programming is widely used in Artificial Intelligence, Natural Language Generation, Neural Networks and other advanced fields of Computer Science. Python had deep focus on code readability & this class will teach you python from basic

Python Programming Characteristics

  • It provides rich data types and easier to read syntax than any other programming languages
  • It is a platform independent scripted language with full access to operating system API’s
  • Compared to other programming languages, it allows more run-time flexibility
  • It includes the basic text manipulation facilities of Perl and Awk
  • A module in Python may have one or more classes and free functions
  • Libraries in Pythons are cross-platform compatible with Linux, Macintosh, and Windows
  • For building large applications, Python can be compiled to byte-code
  • Python supports functional and structured programming as well as OOP
  • It supports interactive mode that allows interacting Testing and debugging of snippets of code
  • In Python, since there is no compilation step, editing, debugging and testing is fast.
co img 786 1544180740show?id=ELEUF*I0Aoo&bids=742306

Python is commonly used by programmers to:

  • Program video games
  • Build Artificial Intelligence algorithms
  • Program various scientific programs such as statistical models

 

Getting Started: Install Python

Before you can make a start, you need to have Python installed on your computer. There are currently two versions: Python 2 and Python 3 (you’ll see point something after the 2 and 3: Python 2.7.14 or Python 3.6.4). We’ll be working with version 3, but you can have both versions on your computer.

To check if you already have the Python files installed, try this:

Windows

Start a command prompt. (You can type Command Prompt in the search box.) In Windows 10, the Command Prompt is at this location:

C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools

Once you have the Command Prompt, type the following:

python

Hit the enter key on your keyboard. If it’s already installed, you’ll see the minimum version you have on your system:

Python 2.7.14

If you don’t have it, you’ll see a message starting “python is not recognized …”. If you see that message, you don’t yet have Python installed on your computer. In which case, see the installation guide below. If the Command Prompt doesn’t tell you that you have version 3 point something, click into the Windows search box at the bottom of the Desktop. Type python:

py version win10If you see version 3, as in the image above, then you’re good to go. If not, you’ll need to download and install version 3 (See download location below).

co img 698 1540474212show?id=ELEUF*I0Aoo&bids=742306

Mac

Launch a Terminal window by clicking the Applications folder. Click on the Utilities folder and you’ll see Terminal. Or do a Spotlight search and the Terminal should launch. Type the following in the Terminal window:

python -V

Press the enter key and you should see which version you have. (Most Macs have Python already installed. (However, it may be just Python 2. Go to the download page below to get Python 3.)

Linux

Open up a shell and type the same as for the Mac:

python3 -V

Press the enter key to see which version you have. Again, most Linux systems already have Python installed. (However, it may be just Python 2, as with the Mac. Go to the download page below to update.)

Python Download Location

If you don’t yet have Python, go to the following address:

https://www.python.org/

Click on Downloads and then on the button that says Download Python 3.6. (Though you can download version 2.7 first, if you want, and then install version 3.6.)

Double click the file you download from the site above to start the install.

Installing Python on a Window computer

We’ve downloaded the file from python.org and double-clicked the file we downloaded to see this screen:

instal 8

Make sure you check the box at the bottom that says Add Python 3.6 to PATH. Click on Install Now at the top. (Incidentally, don’t worry that this is 32-bit software if you have 64-bit computer. The screenshot above is from Windows 10 64-bit.)

On the next screen, you can click the area below for Disable path length limit.

Install Python 3 on a Mac and Linux

The install process for Mac and Linux users is fairly painless, these days. Just download the file for your system and double click to install. You won’t need to disable the path length limit, as on Windows. And you probably don’t need to touch the Terminal, unless you want to.

Next, we’ll download and install the software we’re going to use to do all our Python coding. It’s called PyCharm, and the excellent Community edition is free.

Install PyCharm

You can type and run your code from a Terminal window or Command Prompt. But that’s very tedious. Instead, we’re going to be using a piece of software called PyCharm. This is an IDE created by JetBrains. You can get versions for Windows, Linux and Mac. The page to download the software is here:

https://www.jetbrains.com/pycharm/

Click the Download Now button and it should detect your operating system. There is a free version called Community, and this is the one we’ll be using. Download and install the software. It’s fairly straightforward.

You’ll see a screen like this one when installing (Linux users, scroll down for your install):

install pyCharm

You can check the three boxes at the top. We’ve left the last one unchecked. JRE is the Java Runtime Environment. We already have this. And in any case, JetBrains say you don’t need Java to run PyCharm on Windows and Mac.

One more screen you might see is this:

install pyCharm2

We don’t have a previous version of the software so have selected Do not import settings.

Install PyCharm on a Mac

Once you’ve downloaded the software, installation is just a question of double-clicking the file you’ve downloaded. Once it’s been installed, you should see PyCharm in your Application folder, or be prompted to drag an icon there.

If you’re not using Linux, scroll down to the bottom of this page and go to the next lesson, Launch PyCharm (or use the menu on the left).

Install PyCharm on Linux

Installation of PyCharm can be a little bit tricky. But download the software. You’ll be downloading a tar.gz file. Double click the file and let the Archive Manager extract the files. Click the Extract button on the Archive Manager: (All images are from Linux Mint. Ubuntu users should see something similar.)

archive manager

Click the Extract button top left. Then go to the folder you’ve just extracted.

Now double-click the Pycharm Community folder once you’ve extracted the files:

pycharm folder

Inside of the PyCharm folder, double-click the bin folder:

pycharm bin

Inside the bin folder, locate the file called pycharm.sh:

pycharm sh

Double-click this file. You may see a dialog box asking you if you want to run the file. Click the Run button:

pycharm run

Hopefully, Pycharm will then start up. From now on, you need to double click the pyharm.sn file in the bin folder whenever you want to fire up Pycharm. Or you can create a launcher for it from your desktop.

If Pycharm doesn’t start, and you get an error about JDK 8 not being installed, then it means you haven’t got the Java Development Kit on your system. In which case, try the following:

Open up a Terminal window. Type the following (or copy and paste from here):

sudo add-apt-repository ppa:webupd8team/java

Now type this:

sudo apt-get update

And then this:

sudo apt-get install oracle-java8-installer

If eveything goes well, return to your pycharm/bin folder and double click the pycharm.sh file again. Better yet, add a Desktop shortcut for PyCharm. Enroll in the course below, if you’re not sure how to do this.

Python Scripting Certification Training

Python Scripting allows programmers to build applications easily and rapidly. This course is an introduction to Python scripting, which focuses on the concepts of Python. It will help you to perform operations on variable types using Pycharm.

You will learn the importance of Python in real time environment and will be able to develop applications based on Object-Oriented Programming concept. End of this course, you will be able to develop networking applications with suitable GUI.

co img 777 1542190284show?id=ELEUF*I0Aoo&bids=742306
,

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*