0% found this document useful (0 votes)
12 views15 pages

1.1 Why Program

Uploaded by

ashmaanaslam5
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)
12 views15 pages

1.1 Why Program

Uploaded by

ashmaanaslam5
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
You are on page 1/ 15

Introduction – Part 1

PYTHON FOR
EVERYBODY

Why Program?
Chapter 1

Python for Everybody


www.py4e.com
Introduction – Part 1
PYTHON FOR
EVERYBODY

Computers want to be helpful...


• Computers are built for one purpose - to What
do things for us Next?

• But we need to speak their language to


describe what we want done

• Users have it easy - someone already put


What What What
many different programs (instructions) into Next? Next? Next?
the computer and users just pick the ones
they want to use What What What
Next? Next? Next?
Introduction – Part 1
PYTHON FOR
EVERYBODY

Programmers Anticipate
Needs
• iPhone Applications are a market

• iPhone Applications have over 3 Billion


downloads

• Programmers have left their jobs to be full- Pick Pick Pick


time iPhone developers Me! Me! Me!

• Programmers know the ways of the program Pick Pick Pay


Me! Me! Me!
Introduction – Part 1
PYTHON FOR
EVERYBODY

Users vs. Programmers


• Users see computers as a set of tools - word processor, spreadsheet, map,
to-do list, etc.

• Programmers learn the computer “ways” and the computer language

• Programmers have some tools that allow them to build new tools

• Programmers sometimes write tools for lots of users and sometimes


programmers write little “helpers” for themselves to automate a task
Introduction – Part 1
PYTHON FOR
EVERYBODY

Why be a programmer?
• To get some task done - we are the user and programmer

– Clean up survey data

• To produce something for others to use - a programming job

– Fix a performance problem in the Sakai software

– Add a guestbook to a web site


Introduction – Part 1
PYTHON FOR
EVERYBODY

User

Computer
Programmer
Hardware + Software

Data Information .... Networks


From a software creator’s point of view, we build the software. The end users
(stakeholders/actors) are our masters - who we want to please - often they pay us
money when they are pleased. But the data, information, and networks are our problem
to solve on their behalf. The hardware and software are our friends and allies in this
quest.
Introduction – Part 1
PYTHON FOR
EVERYBODY

What is Code? Software? A Program?


• A sequence of stored instructions

– It is a little piece of our intelligence in the computer

– We figure something out and then we encode it and then give it to someone
else to save them the time and energy of figuring it out

• A piece of creative art - particularly when we do a good job on user experience


Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Humans...

https://www.youtube.com/watch?v=gwWRjvwlLKg
Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Humans...


while music is playing:
Left hand out and up
Right hand out and up
Flip Left hand
Flip Right hand
Left hand to right shoulder
Right hand to left shoulder
Left hand to back of head
Right ham to back of head
Left hand to right hit
Right hand to left hit
Left hand on left bottom
Right hand on right bottom
Wiggle
Wiggle
Jump https://www.youtube.com/watch?v=gwWRjvwlLKg
Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Humans...


while music is playing:
Left hand out and up
Right hand out and up
Flip Left hand
Flip Right hand
Left hand to right shoulder
Right hand to left shoulder
Left hand to back of head
Right ham to back of head
Left hand to right hit
Right hand to left hit
Left hand on left bottom
Right hand on right bottom
Wiggle
Wiggle
Jump https://www.youtube.com/watch?v=gwWRjvwlLKg
Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Humans...


while music is playing:
Left hand out and up
Right hand out and up
Flip Left hand
Flip Right hand
Left hand to right shoulder
Right hand to left shoulder
Left hand to back of head
Right hand to back of head
Left hand to right hip
Right hand to left hip
Left hand on left bottom
Right hand on right bottom
Wiggle
Wiggle
Jump https://www.youtube.com/watch?v=gwWRjvwlLKg
Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Python...

the clown ran after the car and the car ran into the tent and
the tent fell down on the clown and the car

Image: https://www.flickr.com/photos/allan_harris/4908070612/ Attribution-NoDerivs 2.0 Generic (CC BY-ND 2.0)


Introduction – Part 1
PYTHON FOR
EVERYBODY

Programs for Python...

Image: https://www.flickr.com/photos/allan_harris/4908070612/ Attribution-NoDerivs 2.0 Generic (CC BY-ND 2.0)


Introduction – Part 1
PYTHON FOR
EVERYBODY

name = input('Enter file:')


handle = open(name)

counts = dict()
python words.py
for line in handle: Enter file: words.txt
words = line.split() to 16
for word in words:
counts[word] = counts.get(word,0) + 1

bigcount = None
bigword = None
for word,count in counts.items(): python words.py
if bigcount is None or count > bigcount: Enter file: clown.txt
bigword = word the 7
bigcount = count

print(bigword, bigcount)
Introduction – Part 1
PYTHON FOR
EVERYBODY

Hardware Architecture

You might also like