Proposal to cut Zebra Puzzle
I have seen a mentoring request on Zebra Puzzle and they asks “[is there a way] to solve it using code”. Reviewing the exercise itself;
Solve the zebra puzzle.
There are five houses.
The Englishman lives in the red house.
The Spaniard owns the dog.
Coffee is drunk in the green house.
The Ukrainian drinks tea.
The green house is immediately to the right of the ivory house.
The Old Gold smoker owns snails.
Kools are smoked in the yellow house.
Milk is drunk in the middle house.
The Norwegian lives in the first house.
The man who smokes Chesterfields lives in the house next to the man with the fox.
Kools are smoked in the house next to the house where the horse is kept.
The Lucky Strike smoker drinks orange juice.
The Japanese smokes Parliaments.
The Norwegian lives next to the blue house.
Each of the five houses is painted a different color, and their inhabitants are of different national extractions, own different pets, drink different beverages and smoke different brands of cigarettes.
Which of the residents drinks water? Who owns the zebra?`
This seems like a logic question and not a Python-specific question. Besides, the answer is literally available at Tests:
If I were to solve this algorithmically, it would definitely step into AI territory and isn’t in the Python syllabus. (The method would be similar to https://github.com/KevinLiTian/Harvard_CS50_AI/tree/main/1.Knowledge/knights , but the gist is the implementation of said algorithm, or even the data structure required to solve this is horribly out of scope)
Therefore, I propose removing Zebra Puzzle from the Python exercises.
That is perfect for logical programming and not necessarily a pure “AI” problem. If you have ever used Prolog, this is what it’s made for. There are some Python libraries, that can mimick Prolog like Pyke.
Yeah, I was thinking about the Z3 SMT Solver when I made the initial post. I know Z3 SMT solver isn’t exactly AI per se (it is at least deterministic) but it does deal with knowledge in computer format and saying it is in AI is from listening to CS50 AI.
Chiming in as a track maintainer to add that the Python Syllabus is far from done and dusted. It is actively (albeit slowly) being worked on, so just because a concept is not (yet) there doesn’t mean it won’t be in the future, or that practice exercises that don’t conform to Syllabus topics should be tossed out.
In fact, the practice exercises predate the concept exercises, and are much more open-ended as to which data structures and strategies solve them. You should have the expectation that the Syllabus doesn’t (and might not ever) cover everything the language has to offer - especially topics like Abstract base classes, asynchronous programming, event loops, user interaction, OS walking, and other things from the (vast) standard library. We aim for fluency - but not encyclopedic knowledge.
Personally, I don’t think any one resource or strategy for learning Python - or any other programming language - can be exhaustive/all-in-one.
And, as @IsaacG has pointed out - this is not a Python-specific exercise, only a Python-specific version of this problem-specifications exercise.
We are well aware that there are gaps in the Syllabus, and also gaps in practice exercises that help cement Syllabus topics. We’re … working on it … but that work doesn’t go very quickly, and relies on a lot of volunteer time and energy.
The example solution for this exercise doesn’t use anything exotic. Now, it is truly ugly and anyone who writes a comprehension like that should be punished ( ) – but this exercise can be solved with code and not AI/ML or any special libs.
Just supposing, for the sake of argument, that I was interested in helping with this, what would be a useful way to start? I’m nowhere near being a @BethanyG- level Python expert, but:
- I’ve used it for some years
- I’ve completed the existing syllabus
- I’ve written a few concept docs on other tracks (though I’m bad at inventing new exercise stories)
- Most importantly, I’m neither emotionally-sensitive nor litigious. So if you don’t like my stuff you needn’t waste time trying to avoid hurting my feelings!
I’ve just looked at the existing overview, but it’s slightly overwhelming.
@colinleach – Thank you so much for asking! My answer to this is always “it depends” (on time, on inclination, on experience, on familiarity with exercim itself …).
Finding typos or suggesting test cases/edits to docs are always welcome for discussion, and generally have a low barrier to entry. Other things like approaches, mentor notes, on up to new practice exercises or concept exercises increase in difficulty and also in overhead for me.
But before we dig into details, could you move your post to a new thread, so that we don’t hijack this one? Or better yet, send me a private message here or on Discord, and we can discuss what you might be interested/not interested in diving into.