Unformatted text preview:

COMP 116 Instructor Jason Carter A PROGRAM Set of instructions that a computer follows to perform a task or solve a problem WHAT IS A PROGRAM Set of instructions that a computer follows to perform a task or solve a problem PEANUT BUTTER JELLY SANDWICH WHAT DID WE LEARN FROM THIS EXERCISE Computers are dumb Computers only do what you tell them to do Computers do what you tell them to do really fast so they appear smart but they are not Computers don t remember anything unless you tell them how to remember Computers take your instructions literally If you tell them to do something dumb they do it Computers only do what they are told and in exactly the order you tell them WHAT LANGUAGE DO COMPUTERS UNDERSTAND A computer understands 1 s and 0 s Sequences of 1 s and 0 s CPU Central Processing Unit Reads instructions from memory Decodes fetched instruction to determine which operation to perform Perform the operation Operation Examples reading data adding subtracting multiplying and dividing numbers MACHINE LANGUAGE Reasons for not using machine language Virtually unreadable Hard maintain and debug No mathematical functions available we need to create our own code for these routines every time we write a new program Memory locations are manipulated directly requiring the programmer to keep track of every memory location on the computer How much memory does your computer have OVERCOME DIFFICULTY OF USING MACHINE LANGUAGE Want to use a English like language Computers only understand machine language 1 s and 0 s English Like Language Converter Machine Language English Like LanguageConverterMachine Language HIGH LEVEL LANGUAGES Compiled Java C C Interpreted Python PHP COMPILED LANGUAGES A compiler reads the program and translates it completely before the program starts running Java C C Compiler Machine Language Java C C CompilerMachine Language INTERPRETED LANGUAGES Interpreter reads code and performs operations one line at a time Python PHP Interpeter Machine Language Slower than compiled languages Python PHPInterpeterMachine Language WHICH HIGH LEVEL LANGUAGE SHOULD WE USE Compiled Java C C Interpreted Python PHP We will use Python WHY PYTHON Simpler than other languages C include iostream h void main Python print Hello World cout Hello world endl WHY PYTHON Modern language Good Error Detection Rich Library Embodying Many Good Programming Principles REVIEW Computers understand machine language We will be using Python Python is an interpreted language How do we use the Python interpreter Interactive mode enter statements on keyboard Script mode save statements in Python script SCRIPT MODE Save a set of Python statements in a file The filename should have the py extension INTEGRATED DEVELOPMENT ENVIRONMENT IDE A program that provides tools to write execute and test a program Pycharm Community Edition Runs in interactive mode Has built in text editor with features designed to help write Python programs


View Full Document

UNC-Chapel Hill COMP 116 - Introduction

Download Introduction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?