csce 110 programming i - texas a&m...

14
CSCE 110 Programming I David Kebo Houngninou Instructions, algorithms, interpreter Course Introduction

Upload: others

Post on 12-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

CSCE 110Programming IDavid Kebo Houngninou

Instructions, algorithms, interpreter

Course Introduction

Page 2: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

What is the outcome of this course?

• Develop an understanding of programming• Understand the value of programming• Appreciate the value of experimentation• Acquire problem solving skills• Learn the Python programming language

CSCE 110: Programming I 3Houngninou

What is programming?

Programming is the action of writing code to give a computer instructions to perform some tasks.

CSCE 110: Programming I 4Houngninou

Page 3: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

To program is to solve problems

Houngninou CSCE 110: Programming I 5

What is programming Language?

• A programming language is a formal language.

• Programming languages specify a set of instructions that can be used to perform various actions.

• Programming languages can be used to create programs that implement specific algorithms.

Houngninou CSCE 110: Programming I 6

Page 4: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

Programming languages classification

Houngninou CSCE 110: Programming I 7

Programming languages classification

Houngninou CSCE 110: Programming I 8

Page 5: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

What is the best way to learn a language?

Houngninou CSCE 110: Programming I 9

What is an algorithm?

An algorithm is a finite sequence of steps that solves a problem.

Computational complexity:

How much computing resources are needed to solve a problem?

How long (time) and how much memory (space) does it take?

We observe the behavior of algorithms as the input size grows

Houngninou CSCE 110: Programming I 10

Page 6: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

Problem

Given a list of positive numbers, return the largest number on the list.

Houngninou CSCE 110: Programming I 11

Activity

List 5 programming languages List 5 algorithms

Houngninou CSCE 110: Programming I 12

Page 7: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

How is code executed?

Houngninou CSCE 110: Programming I 13

Code.c, .c++ ...

Machinecode

01010

ProcessorARM

Compiler ProcessorIntel 8086

ProcessorIBM

PowerPC

How is Java code executed?

Houngninou CSCE 110: Programming I 14

Code.java

Machinecode01010

Compiler JavaByteCode JVM

ProcessorARM

ProcessorIntel 8086

ProcessorIBM

PowerPC

Page 8: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

How is Python code executed?

Houngninou CSCE 110: Programming I 15

Code.py

Runtime libraries

ProcessorARM

Interpreter ProcessorIntel 8086

ProcessorIBM

PowerPC

Compiler vs. Interpreter

• A compiler is a computer program that converts an entire program into binary code (machine code) targeted to a specific CPU.

• An interpreter is a computer program that directly executes instructions written in a programming or scripting language, without compiling it into machine code.

Houngninou CSCE 110: Programming I 16

Page 9: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

Interpreter vs. compiler

Interpreting code is different from compiling code.The interpreter executes one instruction at a time.

Houngninou CSCE 110: Programming I 17

Interpreter Compiler

Translates program one statement at a time.

Scans the entire program and translates it as into machine code.

No intermediate object code is generated Generates intermediate object code

Continues translating the program until the first error occurs

Generates the error message only after scanning the whole program.

Python, Ruby, Perl, Matlab etc. C, C++ etc.

Why Python?

• Easy to learn• Solve problems in less time, fewer lines of code• Elegant, intuitive syntax and dynamic typing• Efficient high-level data structures• Ideal for scripting and rapid application development

Houngninou CSCE 110: Programming I 18

Page 10: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

Why Python?

Houngninou CSCE 110: Programming I 19

Applications of Python

• Machine learning

• AI

• Data Science

• Visualization

• Web Applications

Houngninou CSCE 110: Programming I 20

Page 11: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

How to configure your computer?

Houngninou CSCE 110: Programming I 21

1. Install the Python distribution

Anaconda is a free open source python distribution that provides packages and libraries out of the box for data science.

Install Anaconda (Python 3.7 version)https://www.anaconda.com/products/individual

Houngninou CSCE 110: Programming I 22

The core python languagePython packages/libraries

Package manager

Page 12: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

2. Install the IDE

An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development.

Install PyCharm (Community version)https://www.jetbrains.com/pycharm/download/

Houngninou CSCE 110: Programming I 23

An editor designed to handle codeBuild, execution, and debugging tools

Version control

2. Install the IDE

Houngninou CSCE 110: Programming I 24

Page 13: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

2. Install the IDE

The PyCharm community version is open-source and free.It is available for major operating systems: • Windows• MAC• Linux

Houngninou CSCE 110: Programming I 25

About Python

• Python was developed in 1989 by Guido van Rossum in the Netherlands.

• Python was released for public distribution in early 1991.

Houngninou CSCE 110: Programming I 26

Page 14: CSCE 110 Programming I - Texas A&M Universitycourses.cse.tamu.edu/davidkebo/csce-110/lectures/CSCE110_0.pdf · Applications of Python •Machine learning •AI •Data Science •Visualization

How did Python begin?

• van Rossum was having a hard time getting the job done with the existing tools available.

• He envisioned that there was an easier way to get things done.

• Python has been around for over 30 years, it is still relatively new to general software development.

• Python has lots of support from the community.

Houngninou CSCE 110: Programming I 27

End

Houngninou CSCE 110: Programming I 28