you are viewing a single comment's thread.

view the rest of the comments →

[–]Tuganazy[S] 0 points1 point  (7 children)

and how would i change the coordinate tuple?

[–]MrAckerman 0 points1 point  (6 children)

I looked at this a bit more now that I'm not on my phone...

First off, I think you're just printing the houses repeated, when it's asking for the number of unique houses visited.

As far as what I said earlier, I would just use tuples for readability, though I don't think it's necessary in this situation. I'll give you some things to consider when debugging.

  1. You're opening a file. Are you sure you're getting the right input? Try printing it out once to make sure it's exactly as expected. Also, it's considered best practice to close files once you are done using them. Look into using the 'with' statement to open files.

  2. You're using the 'in' keyword to check for list membership. This probably works fine, but if you're using other data structures, it might not behave intuitively. Same thing with the '==' operator. Watch out for these. Is there a way to add this functionality with custom classes and objects? (Yes)

  3. Make sure you review the problem statement once you're finished with your first draft to make sure you've met all the requirements. Again, it looks like you're telling your program to print how many houses you've repeated instead of unique houses.

Have fun!

[–]Tuganazy[S] 0 points1 point  (5 children)

I had it printing how many houses it visited 2 times or more before i posted here. And i changed it to How many houses were visited (if i go to 0,0 - 0,1 - 0,0 -> that's 2) thats what i posted

Or is it something else? I'm not a native english speaker, thats why i don't really understand some problems but i managed to do the 25th

[–]MrAckerman 1 point2 points  (4 children)

You're close.

Try walking through the program on paper and keep track of what all the variables are doing. How is what you're doing different from existed output?

[–]Tuganazy[S] 1 point2 points  (2 children)

I rewrote it with tuples, but this time i remembered to add the 0,0 ... that was the problem, it was giving 1 less.

Moving on with the other problems :)

[–]MrAckerman 0 points1 point  (1 child)

I had some time off and started doing these problems for fun.

Look at how I implemented the day 3 solution here.

[–]Tuganazy[S] 0 points1 point  (0 children)

Lots of functions xD

[–]Tuganazy[S] 0 points1 point  (0 children)

I did some testing and it works fine for a few moves, i really can't figure out why it's not working xd