0% found this document useful (0 votes)
9 views

Py4Inf 01 Intro

John Doe, Anytown University Contributors: Jane Smith, Big State University
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Py4Inf 01 Intro

John Doe, Anytown University Contributors: Jane Smith, Big State University
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Why Program?

Chapter 1

Python for Informatics: Exploring Information


Computers want to be helpful...

• Computers are built for


one purpose - to do things
for us
• But we need to speak their What’s
Next?
What’s
Next?
What’s
Next?
language to describe what
we want to be done What’s What’s What’s
Next? Next? Next?
Programs
• Sequences of instructions and
computations is called a program.
• A programming language is a
notation used to write instructions into
a computer.
• These programs will be based on
algorithms.
Algorithm

• a step-by-step problem-solving
procedure.
• Too much to compute in one step, so
break down into smaller steps.
• A programmer is a person who creates
programs that solve a problem using the
computer.

• A bug is an error in a program.

• Debugging is the process of removing


errors, testing and revising a program to
make sure that it performs as expected.
Understanding programming

•You need to know the


programming language
 SYNTAX – vocabulary and
grammar
•You will be able to write a
program
Python
•is a high-level language intended to be
relatively straightforward for humans to
read and write and for computers to
read and process.
•Other high-level languages include:
Java, C++, PHP, Ruby, Basic, Perl,
JavaScript, and many more.
Python

•Python’s
implementiom was
started in December
1989 by Guido van
Rossum
Machine Language
•The actual hardware inside the Central
Processing Unit (CPU) does not
understand any of the high level
languages.
•The CPU understands a language we
call machine language
Machine Language

•Machine language is very simple and


frankly very tiresome to write because it
is represented all in zeros and ones:
010100011101001001010100000011111
1100110000011101010010101101101...
High-
Level
01001001
00111001 if x< 3: print

Central
Processing
Unit

Machine
Language
High-Level Language

•Because the CPU understands only


machine language instructions,
programs that are written in a high-level
language must be translated into
machine language.
High-Level Language
•Depending on the language that a program
has been written in, the programmer will
use either
A COMPILER
or
AN INTERPRETER
to make the translation
Compiler

•A compiler is a program that translates


a high-level language program into a
separate machine language program.
•The machine language program can
then be executed any time it is needed.
Compiler

As shown in the figure, compiling and


executing are two different processes.
Interpreter
•The Python language uses an interpreter,
which is a program that both translates
and executes the instructions in a high-
level language program.
•As the interpreter reads each individual
instruction in the program, it converts it to
machine language instructions and then
immediately executes them.
•This process repeats for every instruction
in the program.
Interpreter

Because interpreters combine translation and


execution, they typically do not create separate
machine language programs.
Acknowledgements / Contributions

These slides are Copyright 2010- Charles R. Severance (


...
www.dr-chuck.com) of the University of Michigan School of
Information and open.umich.edu and made available under
a Creative Commons Attribution 4.0 License. Please
maintain this last slide in all copies of the document to
comply with the attribution requirements of the license. If
you make a change, feel free to add your name and
organization to the list of contributors on this page as you
republish the materials.

Initial Development: Charles Severance, University of


Michigan School of Information

You might also like