Jed Rembold & Fred Agbo
April 1, 2024
Problem Sets 5 and Midterm #2 grading were posted last week
Although the majority did well, I’m considering curving the grades across by 10%
Grading of project 1 to be published soon on canvas
My version of solution to Midterm #1 exam is posted in this week module
Feeling that things are not going as expected and need to discuss?
Project #3 ImageShop is posted and is due next week Monday 8th Apr at 10pm
What would be the output of the printed statement in the code to the right?
class Pet:
def __init__(self, name, color, age):
self.name = name
self.color="black"
self.age = age
def bmi(self, weight, height):
if weight/height > 2:
self.age = self.age*2
else:
self.age += 1
dog = Pet("Loly", "brown", 2)
dog.bmi(180,45)
print(f'{dog.name}, {dog.color}, {dog.age}')
GImage
type objectGrayscaleImage.py
that you can import into
your main programGButton
GButton
gets a label and a callback
function name that determines what function is called when that button
is clickedadd_button
function which will take care of
adding a new button to the correct part of the screen.
GImage
currently
displayed on the window in a variable called
gw.current_image
gw
so that you will have access to it in any
callback function you writeset_image
on the output of your manipulation
function, which will take care of updating the value of
gw.current_image
ImageShop.py
as needed.
Python dictionaries use squiggly brackets
{}
to enclose their contents
Can create an empty dictionary by providing no key-value pairs:
empty_dict = {}
If creating a dictionary with key-value pairs
:
,
generic_dict = {'Bob': 21, 0: False, 13: 'Thirteen'}