Development Environment

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Advertisements

The Internet. Telnet Telnet means using your computer as a terminal. All commands you type are sent to the host computer you are connected to and executed.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Software Development. Chapter 3 – Your first Windows 8 app.
Lesson 4 Computer Software
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Python From the book “Think Python”
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Intermediate 2 Software Development Process. Software You should already know that any computer system is made up of hardware and software. The term hardware.
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
Installing Java on a Home machine For Windows Users: Download/Install: Go to downloads html.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
CWA 3105 Presents At&t Connect for Windows pc This will be a quick set up guide for our new virtual meeting program We are the ELITE to have this trial.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Emdeon Office Batch Management Services This document provides detailed information on Batch Import Services and other Batch features.
Computers and Programming
Introduction to Computers
Lesson 11 Exploring Microsoft Office 2007
Installing Java on a Home machine
John Metz and Jeff Potts Michigan’s A. E. R. Annual Conference 2017
MET4750 Techniques for Earth System Modeling
WikID installation/training
Topics Introduction Hardware and Software How Computers Store Data
SQL and SQL*Plus Interaction
CSCI-235 Micro-Computer Applications
Key Ideas from day 1 slides
11.10 Human Computer Interface
Topics Introduction to Repetition Structures
Single Sample Registration
Eclipse Navigation & Usage.
Mail Merge And Macros in MS WORD
Introduction to Programming
Variables, Expressions, and IO
Functions CIS 40 – Introduction to Programming in Python
Chapter 3 Software Interfaces.
Bomgar Remote support software
Installing Java on a Home machine
Introduction to Computers
Selection CIS 40 – Introduction to Programming in Python
Introduction to Programming
Week 1 Computer Programming Year 9 – Unit 9.04
CIS16 Application Development Programming with Visual Basic
How to Run a Java Program
File IO and Strings CIS 40 – Introduction to Programming in Python
Introduction to Algorithm Design
Topics Introduction Hardware and Software How Computers Store Data
Loops CIS 40 – Introduction to Programming in Python
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Introduction to TouchDevelop
Introduction to Programming
Programming.
Windows Installation Tutorial
12th Computer Science – Unit 5
Chapter 1: Programming Basics, Python History and Program Components
Introduction to Python
Introduction to Programming
Microsoft Office Illustrated Fundamentals
1.3.7 High- and low-level languages and their translators
Starter Which of these inventions is: Used most by people in Britain
Programming Logic and Design Eighth Edition
Presentation transcript:

Development Environment CIS 40 – Introduction to Programming in Python De Anza College Clare Nguyen

Intro In this module we learn how to communicate with the computer so that we can give it instructions to run. As with all communications, we need to speak the same language as the computer, and in this class we will use the Python programming language to write our instructions. We also observe the result of our instructions, and if needed, we learn how to debug our instructions so that we get the expected output for our program.

Development Cycle (1 of 3) When we write a set of instructions or a program to run on the computer, we perform one step of the development cycle. The development cycle describes a process to plan, create, test, release, and maintain software. Plan: the purpose and requirements for the software are defined. Create: using the requirements as the guide, design and then write instructions (or code) to produce or develop the software. Plan Test Create Release Maintain

Development Cycle (2 of 3) Test: run the software with different input, observe the output, debug or fix error in the software until the output is as expected. Release: send the software to the users or customers who will use or run it. The release is often in several stages, depending on the software complexity and the size of the customer base. Maintain: support users by providing bug fixes, updates, training, and installation. 1. The next version of the software starts again at the planning stage. Plan Test Create Release Maintain

Development Cycle (3 of 3) For this class, the class exercises and homework assignments represent the planning stage of the development cycle. In the assignments you find the description of the task that needs to be done and what the input and output requirements are. Based on the task description, you write instructions (or code) to create the program to do the specified task. When you run the program to observe the output, you are testing the code. If the code produces an unexpected result, you debug or find the source of the error in the code, then you fix the error and test the code again until the output is correct. When you submit your assignment, it is the equivalence of releasing your software to the users. Someone else (the instructor, for example) will run your program to get a task done.

Python Programming Language Our main activity in this class is to write a set of instructions (which make up a program) that the computer can follow to successfully complete a specified task. In module 1 we found that computers “speak” in the binary language, where all data are 1’s and 0’s. But luckily we don’t have to write our instructions for the computer in binary. Instead we use the Python programming language, which is similar to the English language (print (“hello”) is a Python statement) or math language (2 + 3 is another statement). Python itself is a program that have been written to do a task. Its task is to be an interpreter: to take our instructions that are written in the Python language and translate them into binary so that the CPU can understand them and run them. Instruction in Python language Instruction in binary language print “hello” Python interpreter 100100110100100

Downloading Python (1 of 4) How do we get this cool Python interpreter? It’s not only cool, it’s free. For this class we will use Python 3.5.2 If your computer already has Python, please check that it’s Python 3.5.2. If you don’t have Python or don’t have the correct version, follow these steps to download it: Go to https://www.python.org/downloads/release/python-352/ Scroll to the section called Files and click to select the installer for the type of operating system you have (Windows, Mac, or Linux). Then click on Save File to download the installer on your computer. When done: On a Windows computer, look for the icon: On a Mac, look for the icon:

Downloading Python - Windows (2 of 4) Click on the installer icon to run it. You should see a window that looks similar to this: Click to check the box “Add Python 3.5 to PATH” Then click Install Now. The installer program will run to download files from the network and install them in the appropriate locations on your computer. When it is finished, select Close to close the install window. Click to check this box

Downloading Python - Mac (3 of 4) Click on the Python.mpkg installer package to run it. You should see a window that looks similar to this: Read the licensing agreement pages, click Continue and Agree to walk through the pages and give your consent. Click Install to run the installer, which will download and install files from the network to the appropriate locations on your computer. When it is finished, select Close to close the install window.

Downloading Python – Linux (4 of 4) As a Linux user, we assume that you are fairly experienced with downloading and installing different software packages. Python is a default package for most Linux distributions, so most likely you already have Python on your system. You just need to check whether you have Python 3.5.2. If not, use the package manager of your Linux distribution to select Python 3.5.2 to download and install.

Run Python To run Python on your computer: Find the icon for Python and click to start Python On the Mac: Go to the /Applications folder and then the Python3.5 folder, then click on the IDLE icon: On Windows: Go to the Start menu, click on the IDLE icon: Depending on the Windows version, you may need to first find IDLE in your list of Apps, and under Python 3.5. Then pin it to the Start menu before you can see it in the Start menu. Python starts running by showing the window for IDLE, the default development environment:

IDLE IDLE is an acronym for Integrated DeveLopment Environment A development environment is a set of tools that provide the following services: A way to enter instructions or code, and optionally save them to a file A way to run the code A way to see the output A way to debug or find error in the code IDLE integrates or combines these tools into one package, and interacts or communicates with us through a shell

IDLE Shell (1 of 2) The shell is the user interface: a way for us to interact or “talk” with the computer. Some other user interfaces that you’ve used are the touch screen on your phone, the buttons and screen of the check out registers at a store, etc. When the shell first starts, it identifies the Python version and then prints the shell prompt: The shell prompt tells us that the shell is ready to accept Python statements or instructions from us.

IDLE Shell (2 of 2) To enter a Python statement, type it in at the shell prompt and hit Enter when done. The statement will be interpreted by Python and sent to the CPU. Then it is run by the CPU, producing a result which is displayed by the shell. If there is an error in the instruction: the CPU stops running the instruction and the error message is sent to the shell to be displayed. Python statement Result from running the statement Next shell prompt Error message

Debugging (1 of 2) To debug means to find and correct an error that is in a Python instruction. When we run our instructions and get an unexpected result, it means there is an error that needs to be debugged. There are 2 types of error: Syntax error: the instruction is not in the correct format, so the Python interpreter cannot translate it to binary. When there is a syntax error, the interpreter will try to give us a clue in the error message on what the error might be. In this example, the correct format is: print (“hello”) Error message

Debugging (2 of 2) Runtime error: the format of the instruction is correct, but the CPU cannot successfully run it. In this example, the instruction says to divide 2 by 0. Since divide by 0 is an illegal math operation, the CPU cannot complete this operation and sends out the error type of ZeroDivisionError to help us pinpoint the error.

Coding and Debugging Click for a video demo on how to write instructions for the computer, run them, and debug them if needed

Python Script (1 of 2) The shell provides an easy way to write a line of Python code, run it, and debug it. However, when we have multiple Python statements to run one after another, it is easier to type all the statements in a file, save the file, and ask the shell to run the entire file for us. When multiple Python statements are put together in a file, the file is called a program, or more specifically, a Python script. A Python script can have a name, and the name must end with the extension .py When there are multiple lines of code in a script, the Python interpreter runs one line at a time, in the order from the top to the bottom of the file, until all the statements have run. If there is an error in the file, the CPU stops running the code and prints a corresponding error message.

Working With a Script To start a new script, at the shell window, select from the pull down menu: File => New File To start with an existing script, at the shell window, select from the pull down menu: File => Open File and click to select the file from the list of files. A text editor window will appear. We use the text editor to type in the Python instructions and save them in a .py file. To test the Python code in the script, at the text editor window select the pull down menu: Run => Run Module or, use the keyboard shortcut key: F5 If there is no error, an IDLE shell window will pop up to display the output of the script. If there is error, an error window will pop up with an error message, and the line with error will be highlighted in red.

Advantage of a Script What is the advantage of writing a script, instead of running one statement at a time at the shell prompt? When we need to do a complicated task that requires multiple statements to work together, then a script keeps all the statements together in one memory space and we can coordinate the statements to work with each other. When we need to run the same task many times, and the statements for that task is in a script, then we only need one command to run the script, and we don’t have to type all the instructions over and over again.

Scripting Click for a video demo on how to write Python statements in a script and run it.

What’s Next At this point we can communicate with the computer through Python, and we know how to work with the Python development environment. In the next module, module 3, we will learn some Python statements so that we can tell the computer to do some more work for us.