Python
Programming
ENGR. WENCEL JEAN C. DACAY
Computer Engineering Department
University of Science and Technology of Southern Philippines
Lesson 1: Installation and
Environmental Set-up
2
Why Python?
 Python works on different platforms (Windows, Mac,
Linux, Raspberry Pi, etc).
 Python has a simple syntax similar to the English
language.
 Python has syntax that allows developers to write
programs with fewer lines than some other
programming languages.
 Python runs on an interpreter system, meaning that
code can be executed as soon as it is written. This
means that prototyping can be very quick.
 Python can be treated in a procedural way, an object-
oriented way or a functional way.
3
Python Syntax compared to other programming languages
 Python was designed for readability, and has some
similarities to the English language with influence
from mathematics.
 Python uses new lines to complete a command, as
opposed to other programming languages which often
use semicolons or parentheses.
 Python relies on indentation, using whitespace, to
define scope; such as the scope of loops, functions
and classes. Other programming languages often use
curly-brackets for this purpose.
4
Python Platforms
Python can be run in different platforms such as Windows,
Linux and Macintosh Operating Systems. Let us set-up
Environment in this different platforms.
Getting Started
The most up-to-date and current source code, binaries, documentation,
News, etc., is available on the official website of Python.
Link: https://www.python.org/
Requirements
5
Interpreter
 Python 3.9.0 Interpreter
Text Editor (user’s choice)
 Sublime
 VS Code
IDE (Optional)
 Anaconda
For Submissions:
 Google Classroom
6
Installing Python
Python distribution is available for a wide variety of
platforms (Linux, Windows and Macintosh Operating
System).
Before you start, you will need Python on computer.
Check whether you already have an up to date version of
python installed by entering python in a command line
If you see a response from a python interpreter it will
include a version.
7
Installing Python
Version include Python 3.x or Python 2.x.
Python 2.x and Python 3.x are NOT FULLY COMPATIBLE. If
python start a Python 2.x interpreter, try entering python3
and see if an up to date version is already installed.
8
Installing Python (Windows)
You may download most stable Python Windows In the
https://www.python.org/downloads/windows/. On
Windows, you have a choice between 32-bit (labelled x86)
and 64-bit (labelled x86-64) versions, and several flavors
of installer for each.
32-bit Python will still work in 64-bit version.
9
Installing Python (Mac OS)
You may download most stable Python for Mac OS X Page
In the https://www.python.org/downloads/macos/
Install the current Python 3.x Version.
10
Installing Python (Linux)
Red Hat, CentOS or Fedora, install the python3 and
python3-devel packages
For Debian or Ubuntu, install the python3.x and
python3.x-dev packages
For Gentoo, install the “=python-3.x*” ebuild (you may
have to unmask it first)
11
Installing Code Editor or Python IDE
 PyCharm, get it from
https://www.jetbrains.com/pycharm/. Use the
Community edition which is free. Django works well
with PyCharm.
 Atom Text Editor. Get it from https://atom.io
 Sublime Text Editor.Get it from
https://www.sublimetext.com/
 Spyder IDE. Get it from https://www.spyder-ide.org/
 Eclipse IDE. Get it from https://www.eclipse.org/.
Install Pydev plugin and select Pydev perspective.
12
Standard Naming Convention
1. Python project name: First letter of every word is in
uppercase, all other letters in lowercase.
2. Python source code (called module) file name is: all
lowercase letters only with extension .py
3. Python variable and function names: all lowercase
letters only, may have underscore to separate words
4. Python class name: first letter of every word is
uppercase, no underscore. This is called Pascal
naming convention.
How to execute Python Code
13
 IDLE (IDLE is Python’s Integrated Development Learning
Environment
 Execute via Command Line (Windows)
 Creating a Python File

Python Programming-Lesson 1- Installation and Environmental Set-up.pptx

  • 1.
    Python Programming ENGR. WENCEL JEANC. DACAY Computer Engineering Department University of Science and Technology of Southern Philippines Lesson 1: Installation and Environmental Set-up
  • 2.
    2 Why Python?  Pythonworks on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).  Python has a simple syntax similar to the English language.  Python has syntax that allows developers to write programs with fewer lines than some other programming languages.  Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.  Python can be treated in a procedural way, an object- oriented way or a functional way.
  • 3.
    3 Python Syntax comparedto other programming languages  Python was designed for readability, and has some similarities to the English language with influence from mathematics.  Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.  Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.
  • 4.
    4 Python Platforms Python canbe run in different platforms such as Windows, Linux and Macintosh Operating Systems. Let us set-up Environment in this different platforms. Getting Started The most up-to-date and current source code, binaries, documentation, News, etc., is available on the official website of Python. Link: https://www.python.org/
  • 5.
    Requirements 5 Interpreter  Python 3.9.0Interpreter Text Editor (user’s choice)  Sublime  VS Code IDE (Optional)  Anaconda For Submissions:  Google Classroom
  • 6.
    6 Installing Python Python distributionis available for a wide variety of platforms (Linux, Windows and Macintosh Operating System). Before you start, you will need Python on computer. Check whether you already have an up to date version of python installed by entering python in a command line If you see a response from a python interpreter it will include a version.
  • 7.
    7 Installing Python Version includePython 3.x or Python 2.x. Python 2.x and Python 3.x are NOT FULLY COMPATIBLE. If python start a Python 2.x interpreter, try entering python3 and see if an up to date version is already installed.
  • 8.
    8 Installing Python (Windows) Youmay download most stable Python Windows In the https://www.python.org/downloads/windows/. On Windows, you have a choice between 32-bit (labelled x86) and 64-bit (labelled x86-64) versions, and several flavors of installer for each. 32-bit Python will still work in 64-bit version.
  • 9.
    9 Installing Python (MacOS) You may download most stable Python for Mac OS X Page In the https://www.python.org/downloads/macos/ Install the current Python 3.x Version.
  • 10.
    10 Installing Python (Linux) RedHat, CentOS or Fedora, install the python3 and python3-devel packages For Debian or Ubuntu, install the python3.x and python3.x-dev packages For Gentoo, install the “=python-3.x*” ebuild (you may have to unmask it first)
  • 11.
    11 Installing Code Editoror Python IDE  PyCharm, get it from https://www.jetbrains.com/pycharm/. Use the Community edition which is free. Django works well with PyCharm.  Atom Text Editor. Get it from https://atom.io  Sublime Text Editor.Get it from https://www.sublimetext.com/  Spyder IDE. Get it from https://www.spyder-ide.org/  Eclipse IDE. Get it from https://www.eclipse.org/. Install Pydev plugin and select Pydev perspective.
  • 12.
    12 Standard Naming Convention 1.Python project name: First letter of every word is in uppercase, all other letters in lowercase. 2. Python source code (called module) file name is: all lowercase letters only with extension .py 3. Python variable and function names: all lowercase letters only, may have underscore to separate words 4. Python class name: first letter of every word is uppercase, no underscore. This is called Pascal naming convention.
  • 13.
    How to executePython Code 13  IDLE (IDLE is Python’s Integrated Development Learning Environment  Execute via Command Line (Windows)  Creating a Python File