0% found this document useful (0 votes)
8 views12 pages

Introduction to Python Programming

Chapter 1 introduces programming concepts and the Python programming language, emphasizing the importance of programming in data analysis and application development. It covers the structure of programs, the Input/Processing/Output (IPO) model, and compares programming to cooking recipes. Additionally, it highlights Python's versatility, ease of use, and its applications in various fields such as data science and automation.

Uploaded by

i.moukadem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

Introduction to Python Programming

Chapter 1 introduces programming concepts and the Python programming language, emphasizing the importance of programming in data analysis and application development. It covers the structure of programs, the Input/Processing/Output (IPO) model, and compares programming to cooking recipes. Additionally, it highlights Python's versatility, ease of use, and its applications in various fields such as data science and automation.

Uploaded by

i.moukadem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 1 Introduction to Programming EECE 231 Introduction to Computation

and Python and Programming with Applications

Introduction to
Programming and Python
Chapter 1
Python for Data & Analytics
A Business-Oriented Approach

© 2023 Rose River Software, LLC

Topics
• About Programming
• Programs as Recipes
• About Python
• Programming with Python

Chapter 1: Introduction to Programming and Python 2

AUB
Imad Moukadem 1
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Topics
• About Programming
• Why Programming
• What is a computer program?
• Input / Processing / Output
• The art and science of programming
• Programs as Recipes
• About Python
• Programming with Python

Chapter 1: Introduction to Programming and Python 3

About Programming
Why Programming
• Why are so many people learning computer programming?
• The interest and value of computer programming has grown due to the
intersection of:
• Data availability and accessibility
• Analysis of data
• Programming languages and tools

Chapter 1: Introduction to Programming and Python 4

AUB
Imad Moukadem 2
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

About Programming
What is a computer program?
• A computer program takes input, processes it in a desired way, and
provides output
• Programs:
• Contain data
• data may be simple or composite
• Operate on the data
• as defined in statements, and follow a sequence of steps
• Are written in a computer-interpretable language
• Each language has its own syntax

Chapter 1: Introduction to Programming and Python 5

About Programming
Input / Processing / Output (IPO)
• Programs collect input, process the data, and provide output
• This pattern is called Input / Processing / Output (IPO)
• Your goal in programming is to decide the inputs, how best to
organize the data, what processing is needed, how best to organize
the processing, and how to output the results

Chapter 1: Introduction to Programming and Python 6

AUB
Imad Moukadem 3
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

About Programming
Input / Processing / Output (IPO)
• There are a variety of forms that input and output may take
• Some examples:

Once input is read into a program, the


data is stored in the computer's memory
(RAM – random access memory), which
is fast compared to other types of
storage, but only retained while the
program runs

Chapter 1: Introduction to Programming and Python 7

About Programming
The art and science of programming
• The science of programming includes:
• the syntax of the programming language
• the different types of data types
• There is a variety of ways data and logic can be organized
• The art of programming includes:
• from where to collect data
• how to organize data within the program
• how to organize the programming logic
• how and where to provide the results

Chapter 1: Introduction to Programming and Python 8

AUB
Imad Moukadem 4
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Topics
• About Programming
• Programs as Recipes
• About Python
• Programming with Python

Chapter 1: Introduction to Programming and Python 9

Programs as recipes
Cooking Cooking example Programming Coverage
storage refrigerator input source Chapter 2, 7, 14
ingredient ¼ pound mushrooms variable Chapter 2
direction cut up mushrooms statement Chapter 2
alternatives butter or margarine decisions Chapter 3
repetition break each egg; repetition Chapter 4
whisk eggs until blended
parts cook eggs; functions Chapters 2, 5
sauté mushrooms
serving plates output destination Chapter 2, 7, 14
plating arrange on plate formatting Appendix C
problem pieces of shell in eggs exception Appendix D
cookbook breakfast recipes packages Parts II, III

Chapter 1: Introduction to Programming and Python 10

AUB
Imad Moukadem 5
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Programs as recipes
Spreadsheet Compare/Contrast:
Programming Steps vs. Spreadsheet Recalculation
• When developing a program, we need to state the processing order
explicitly
• This is in contrast to a spreadsheet, which has a calculation engine that
determine the order of calculations for you
• This is a key difference between building a spreadsheet and writing a
program
• Considering the right sequence of steps is part of your goal when
developing programs, and can be challenging as you write your initial
programs

Chapter 1: Introduction to Programming and Python 11

Topics
• About Programming
• Programs as Recipes
• About Python
• Some uses of Python
• Python compared with some other languages
• Python version history
• Programming with Python

Chapter 1: Introduction to Programming and Python 12

AUB
Imad Moukadem 6
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

About Python
Some uses of Python
• Python is a general-purpose language and a great choice for several
types of programs, including:
• Applications, from small apps to large-scale enterprise-wide systems
• Data Science, for seeking patterns in data
• Automation Utilities, to streamline certain tasks
• Prototypes, to verify a certain technical approach will work
• Model Development, to build algorithms for solving particular problems

Chapter 1: Introduction to Programming and Python 13

About Python
Some uses of Python
Program Type Example
A university's course registration system keeps track of all courses offered
Application including their descriptions and prerequisites, information about enrolled
students, and which students are registered for which courses
A marketing analyst has detailed transaction data from the company's sales
Data Science database, and wishes to find patterns in recent sales, to help decide where best
to spend the marketing budget in the period ahead
A planning analyst needs to consolidate forecast data in spreadsheets from
Automation different business areas, in order to create a company-wide projected income
statement
A sales engineer for a health technology company needs to confirm that a client's
Prototype new system can provide data that can be imported into the company's primary
analytics application
Model An analytics specialist is developing a model-based approach to optimize
Development production planning at a consumer goods company
Chapter 1: Introduction to Programming and Python 14

AUB
Imad Moukadem 7
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

About Python
Python compared with some other languages
• Python is a general purpose language compared with C++ and Java
• Python easier to learn and write (fast at develop time)
• C++ harder to learn, but designed to run fast (faster runtime)
• Java designed for large-scale systems
• For web-based applications, web browsers understand:
• HTML – represent page content
• CSS - to define page layout and style
• JavaScript – to handle a web page's activity
• Web browsers by default cannot run Python
• Python can be a good choice behind the scenes for "back-end" logic of a web system
• Data oriented languages
• SQL for working with relational databases (and can work with Python)
• JSON and XML for representing data structures, to communicate data between programs
and/or save and retrieve data (Python can work with these)

Chapter 1: Introduction to Programming and Python 15

About Python
Python version history
• Designed and implemented by Guido van Rossum
• Some goals: ease of use, readability, extensibility
• Initial public release in 1991
• Current major version 3 ; not compatible with version 2
• If you search for help, indicate 'Python 3' as part of your search

Chapter 1: Introduction to Programming and Python 16

AUB
Imad Moukadem 8
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Topics
• About Programming
• Programs as Recipes
• About Python
• Programming with Python
• Alternative ways to run Python
• Some key Python features
• Python with packages

Chapter 1: Introduction to Programming and Python 17

Programming with Python


Alternative ways to run Python
• There are 3 primary alternative ways to run Python
• Interactively – one (or few) lines of code at a time
• The standard Python interactive prompt is: >>>
• Code files (also called scripts), with .py extension
• The above two approaches are provided in Integrated Development Environments (IDEs)
• Notebook tool – run one or several lines of code in a code cell
• Save inputs and outputs in a .ipynb file
• Also supports documentation cells

Chapter 1: Introduction to Programming and Python 18

AUB
Imad Moukadem 9
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Programming with Python


Alternative ways to run Python
• Notebook code and output are shown in book and these slides like:
code
[3]: dfAQI[[Link] <= 100]

step #
output result

Chapter 1: Introduction to Programming and Python 19

Programming with Python


Some key Python features
• indenting required for certain cases
parent statement:
child statement 1
child statement 2

• Use of English words instead of symbols, e.g.,
• and instead of &&
• or instead of ||
• Python determines and keeps track of data types
• Many other languages require you to explicitly state data types
• Python runs on different operating systems
Chapter 1: Introduction to Programming and Python 20

AUB
Imad Moukadem 10
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

Programming with Python


Python with packages
• A large number of high quality and featureful software libraries
(called packages) have been developed for use with Python
• Easy to find, download, and use Python packages
• Packages allow you to be highly productive
• For example, in a few lines of code, you can:
• gather data from the internet
• create a summary report
• display results as a chart

Chapter 1: Introduction to Programming and Python 21

Topic Recap
• About Programming
• Programs as Recipes
• About Python
• Programming with Python

Chapter 1: Introduction to Programming and Python 22

AUB
Imad Moukadem 11
Chapter 1 Introduction to Programming EECE 231 Introduction to Computation
and Python and Programming with Applications

© 2023 Rose River Software, LLC


All rights reserved. This material may not be copied or distributed without permission from Prospect Press
23

AUB
Imad Moukadem 12

You might also like