This week we continue working on the projects contained in the GASP Python Course.
Shout out to Andrea for having the most concise and useful answers to the OOP questions, which I share with you here:
What is object-oriented programming (OOP)? When was it created, and why?
OOP is the pattern of creating classes and objects, classes acting like instructions to making the objects. It was created in 1966 by Alan Kay to optimize big projects with many moving parts and data.
What are the principle characteristics of OOP?
The principle characteristics of OOP are abstraction (representing features without detail), encapsulation (wrapping data into one unit), inheritance (objects aquiring properties of other objects), and polymorphism (letting many methods achieve one task)
How is OOP supported in Python?
OOP is supported in Python through the use of class, __init__ (the initializer always present), and self (the object)
Shout outs to Liam and/or Tyler, Andrea, JFK, Meiji, Josh, and Silas for their
robots.py. We will be going over this in class on
Friday, April 9th
Monday, April 5th
Today is a synchronous online B day, but I have an appointment with my orthopedic surgeon this afternoon, so while I will be available during my office hour from 7 to 8 am today, I will not be here during class.
Your assignment both during class and for homework is to write a program in
a file named
math_quiz.py as described in
Sheet 2: Turning the Tables. When your final program is run, it should
produce output like that described in the Planning it out section:
What’s 6 times 7? 49
No, I’m afraid the answer is 42.
What’s 3 times 2? 6
That’s right – well done.
...And so on, with several more questions...
What’s 5 times 9? 45
That’s right – well done.
I asked you 10 questions. You got 7 of them right.
Please treat this as a customer specification, which means you should reproduce the wording of the interactions with your program exactly as decribed above, and not change them in any way.
I have moved the
read_number() function into the
gasp.utils module, and delayed introducting it until
Sheet 4: Higher! Lower!, but you may want to use it in this program. We
will talk more about this decision in class, and I will ask for your feedback.
(note: If you don't know what I am saying here, you can just ignore it
for now, and follow what is done in sheet 2.)
You will earn an A for this activity if you have a working version of
math_quiz.py in your git repo that asks 10 random multiplication
questions with operands between 0 and 12, and then reports to the program
user how many questions they got right at the end of the quiz. We will talk
about possible extensions to this program in class, but that is all it should
do for now.