London|25-SDC-NOV| FATMA DEGIRMENCI | Sprint 5|Prep exercise Python#315
London|25-SDC-NOV| FATMA DEGIRMENCI | Sprint 5|Prep exercise Python#315fatmaevin wants to merge 11 commits intoCodeYourFuture:mainfrom
Conversation
…update find_possible_laptops
a0f40c5 to
0cc0f04
Compare
LonMcGregor
left a comment
There was a problem hiding this comment.
Good start on this sprint's tasks, I have spotted a few areas where you could improve code further
Remember to include a summary of the changes in the pull request text.
There was a problem hiding this comment.
Can you explain the difference between methods and functions, and any benefits/disadvantages?
There was a problem hiding this comment.
- Functions are independent and can be used anywhere.
- Methods are defined inside a class and usually work with the object’s data.
- Functions can be reused, but to use object data, you need to pass it as a parameter.
- Methods can access and change object data and help keep the code organized, but you need to create an object to use them.
sprint5/generics.py
Outdated
| def print_family_tree(person: Person) -> None: | ||
| print(person.name) | ||
| for child in person.children: | ||
| print(f"- {child.name} ({child.age})") |
There was a problem hiding this comment.
Can you figure out how to recursively print a full family tree, like grandchildren as well?
There was a problem hiding this comment.
Can you explain why the errors in this file occur?
There was a problem hiding this comment.
I got errors because the Parent class only has the get_name method. It cannot use the methods in the Child class. But when we create a Child object, it has all Parent methods and its own methods, so no errors happen. I commented out the lines that would give errors.
sprint5/enums.py
Outdated
|
|
||
| try: | ||
| age = int(age_input) | ||
| except ValueError: |
There was a problem hiding this comment.
When taking input, consider the user experience. Right now it asks or all the input and if there are problems it quits and you have to try again. Could you improve this?
|
good work on this task, it looks complete to me |
Self checklist