Presentation is loading. Please wait.

Presentation is loading. Please wait.

What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:

Similar presentations


Presentation on theme: "What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:"— Presentation transcript:

1 What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:

2 The First Programmer: Countess Ada Lovelace
Wrote some programs intended to run on Babbage’s Analytical Engine circa 1830

3 Programming in the 1940s The first running programs were loaded by rearranging wires or flipping switches on the computer

4 High-Level Programming Languages
Code a program in a high level language that’s close to English Run another program to translate it to instructions that the computer hardware can understand Such translator programs are called compilers

5 Grace Murray Hopper and the First Compiler
Created the first compiler to translate a human-readable program to machine code in 1952 Created COBOL (COmmon Business-Oriented Language) for data processing applications in 1959

6 Why Python? Real-world advantages Pedagogical advantages
Systems programming Graphical user interfaces Internet scripting Component integration Database programming Rapid prototyping Very simple syntax Highly interactive Easy to learn and use Extensive libraries of high-level resources Completely portable, free, and open source Widespread user (programmer) community

7 Obtaining Python Python was invented by Guido van Rossum in 1992
Python comes with most Unix-based computer systems Python for Windows or any other operating system can be downloaded from

8 Basic Elements: Data Numbers Strings: ‘Hi there!’, “Hi there!”, ‘\n’
Integers: 3, 77 Floats: 3.14, .22 Strings: ‘Hi there!’, “Hi there!”, ‘\n’ Truth values (Booleans): True, False

9 Basic Operations: Arithmetic
Symbol Meaning Example + Addition or concatenation x + y - Subtraction x - y * Multiplication x * y / or // Division x / y or x // y % Remainder x % y ** Exponentiation x ** y

10 Built-In Functions A function is an operation that expects zero or more data values (arguments) from its user and computes and returns a single data value Examples: abs(-5) max(33, 66)

11 Library Functions A library is a collection of resources, including functions, that can be imported for use in a program Example: import math math.sqrt(2)

12 Variables and Assignment
Variables are used to name data and other resources Instead of typing 3.14 for π, define a variable named pi to mean 3.14 Assignment (=) is used to set (or reset) a variable to a value pi = 3.14 34 * 34 * pi Variables make programs more readable and maintainable

13 Library Variables Typically define standard constants, such as pi and e Example: import math 3 * math.pi Or: from math import pi 3 * pi

14 Script Mode Longer programs can be edited and saved to a file and then run as scripts (synonymous with programs) Repl.it

15 Developing a Python Script
Repl.it editor Python source code Python compiler Byte code Python Virtual Machine (PVM) Inputs from user Outputs to user


Download ppt "What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:"

Similar presentations


Ads by Google