Introductory Python 3 Course - Summer 2019: Background
Introductory Python 3 Course - Summer 2019: Background
Background
Around 1961 I took an introductory course to learn Fortran 4, a computer language that was developed in the
late 1950s. At that time we ‘wrote’ our code one line at a time, putting each line on a 'punch card'. We used a
special IBM machine with a keyboard to punch those cards. Maybe one of those machines is now in a museum
somewhere, but I have never seen one since around 1970. During that course, I submitted my program as a
deck of punch cards during the day, and the program was then run by a mainframe computer operator sometime
during the night. The punch-card deck was then returned to me the next morning. Typically, the ‘result’ was
something like: “Program stopped on line 487 – syntax not recognized.”
So this gave me an ‘opportunity’ (i.e., early-morning frustration) to correct and resubmit the program: e.g., put a
semicolon at the end of the line by punching a new card 487, put the replacement card into the deck, resubmit
the program, and wait another day. Then the next morning I would get my program results back again, usually
with a message like, “error line 487 – variable x not declared.” And on it goes. I don’t know how I ever got
through the class, I tried to check my code carefully, but I was frequently frustrated by careless syntax errors
that would delay my progress by a whole day. Compare that with the length of time it takes for you to find and
correct a coding error, probably a lot less than 24 hours (more like 20 seconds).
My next experience with Fortran 4 was at my first job out of college, at General Motors Research Laboratories in
Detroit, Michigan. My first task there was to fix and finish a program that someone who I never had the chance to
meet had started to develop. Perhaps he or she had quit the job or had been transferred to some other
assignment within the company. So I was given a deck of about 1000 punch cards to start with. Suddenly I was
the residing expert; few people in my department knew or cared anything about computers or Fortran 4. GM’s
whole research center employed several thousand people. We had one mainframe computer. Personal
computers, and hand-held calculators had not yet been invented. I believe I saw my first copy machine around
that time, made by some little-known company called Xerox.
It took me a couple weeks to complete this computer program that someone else had begun. Its purpose was to
automate the processing of vehicle emission testing data that previously could only be done by hand, an
operation that a technician needed several hours to accomplish. Now GM could submit data for hundreds of
tests at once, and their mainframe computer could give them their data results in a few minutes. Your cell phone
is a much more powerful computer than GM's computer was back then. That multi-million dollar computer
literally filled a room that was larger than our school library. Furthermore, GM contracted to have a full-time IBM
employee on site around the clock to keep it running, in addition to a GM staff employee who was the operator.
Nobody suspected that someday we would all have 'computers' in our pocket that could do much more than that
mainframe computer. But we knew computers were here to stay.
In this course, you will soon discover that 'debugging' is a big big part of writing computer code. You will have a
lot of valuable information available in print and online for this very brief introductory course. You also have
classmates and an instructor (sorta :-) who might be able to help you solve some of the many questions that you
will encounter in learning Python. We are all beginners, so be patient and inquisitive.
I have tried to pick the best language to learn in 2019. I concluded that Python3 is what I should introduce to
you. I then discussed this decision with Chuck Gibson, a close friend who works in the field of Information
Technology, and he agreed that this is a very suitable choice.
Five years from now, Python may be replaced by an even newer and better computer language that is ten times
faster, easier, and better. That's the way computer technology progresses. But your Python knowledge will
certainly enable you to learn that new language much faster than if you were starting from scratch like you may
be doing in this course. Here are several interesting videos that you might want to watch, prepared by someone
who seems to be an unbiased expert with thorough knowledge about several programming languages.
https://www.youtube.com/watch?v=ZrnoQ122pzs
https://www.youtube.com/watch?v=Qo52KfvdUUY
https://www.youtube.com/watch?v=OGVMi3XSFnE
https://www.youtube.com/watch?v=_uQrJ0TkZlc
Introductory Python 3 Course - Summer 2019 Jerry Isaacs rev. 06/15/19 -- p. 2
During our twice-weekly classroom sessions we will work our way through parts of ‘Learn Python 3 the Hard
way’, a pdf course that I purchased recently.
I hope that some of you will finish this introductory course with me. If a few of you show sufficient interest to
continue to explore Python with me, we may then be able to continue with this effort during the next school year.
We will wrestle with some complex problems that hopefully represent the sorts of things that a coding
professional might be assigned in a real-life situation.
Here are the principal items that each of you will need.
1) A laptop PC on which to install Python3 (free), along with Sublime Text, a powerful code editor.
2) and/or an Android phone on which to install Pydroid 3, a free app.
3) or Pythonista, a $10 app for iPhones, iPads. Apple laptops,etc.
Your workstation (desktop PC, laptop , smartphone, whatever) needs an app to read pdf files (Either Kindle or
Adobe Acrobat Reader will work; both are free); also, a thumb drive to transfer files among users will be useful:
During this study, we will attack a few projects in a very limited timeframe: simple ones at first, and one or more
complex ones later. Examples follow. I have no idea where these ideas will lead, but we will all learn a lot about
Python3 to explore this valuable resource, even though we may only barely glimpse at what this language will
allow us to do. Maybe we can also select additional meaningful problems that we use Python to solve (with or
without help from the other students).
Introductory Python 3 Course - Summer 2019 Jerry Isaacs rev. 06/15/19 -- p. 3
Examples:
1. Write a program to query your birth date and find:
the day of the week on which you or anyone else were born. Some people can do this in their
heads, so it should be easy to write a short program to do it. Use Google to come up with an
appropriate algorithm.
Determine a frequency distribution of prime-numbered years per century from years 1 to 2000
Determine the greatest difference between prime numbers (gaps) within a range of exploration.
Total work hours are limited to 45 hours per week, with no more than 10 hours in any given day,
working Monday through Friday. The driver starts the work week at home and ends the week
back at home, spending Monday, Tuesday, Wednesday, and Thursday evenings only at
approved hotels. Write a program that optimizes his route to determine:
a) whether we can accomplish the task, or whether the task is beyond the
scope of the constraints.
b) Minimize the employer’s total cost to service these cities.
c) If the task is not feasible, devise a fall-back plan, e.g. add drivers or drop
cities from the route.
d) If the route has ample time, determine how much time the driver may use
to add additional cities.
Input data include inter-city driving distances and times, service times in each city, hotel rates,
truck operating costs, and hotel costs.
Cities:
Alphatown – home town (no deliveries) Start and end route here.
Brentwood, Charleston, Delta, Evansville, Franklin, Goshen, Hamilton,
Indianola, Jasper, Kenton, LaMarque, and Milton
Introductory Python 3 Course - Summer 2019 Jerry Isaacs rev. 06/15/19 -- p. 4
delivery times: (Delivery times in each city cannot be split between days, but we may want to
look into that proposition. D, G, K - 1 hr F, H, I, J, L, M - 3 hrs B, C, E, - 5 hrs
Company truck operating costs - $8 per mile; Driver salary $2000 per week
Driver must spend one hour each day for lunch anytime between 11 AM and 2 PM.
Gross income = $20K per hour allocated for each city ($720,000/week).
In the morning 3000 people arrive according to a random Poisson distribution between
7:30 and 8:30. They all enter the building on the first floor and go to floors 2 to 31. There is no floor 13.
Assume that destination floors have a random distribution, except that only one percent of them go to
Floor 31.
Each elevator car accommodates 23 people, but it waits only five seconds to close the door if
nobody is queued at the car. (unless there are no passengers in the car, in which case the door remains
open until someone enters and selects a floor). Otherwise, the door closes three seconds after the 23rd
person enters the car. People can move into the elevator at a rate of two passengers every three
seconds.
The elevator goes up from floor to floor according to an algorithm, which includes door open/close
operations, loading and unloading times, and travel times based on accelerations and decelerations for
passenger comfort. We will discuss and formulate an appropriate algorithm.
Our design goal is to minimize the number of elevator cars so that 95 percent of the passengers do not
have to spend more than four minutes to get to their office floor once they reach the elevator lobby each
morning.
6. Database Design
Design an interactive roster and testing program that maintains multiple test scores for all
students in the roster, with capability to add and delete names from the roster, and alphabetize the
roster. The test will allow the students to use their individual password to take the test, immediately
report the result to the student with correct answers for the student, and enter the test score into the
roster program. Accommodate multiple variations of correct numerical answers, e.g. three, Three,
THREE, or 3.