May-11-2018, 07:26 PM
(May-10-2018, 11:19 PM)Truman Wrote:x = int(input()) y = int(input()) n = int(input()) print([i,j] for i in range(x+1) for j in range(y+1) if (((i+j) !=n)))The goal is to print all possible coordinates.
I receive a generator object message. Don't understand why.
Add another set of angular brackets in a print statement - within and next to outermost brackets.
And
(((i+j) !=n))is extremely ugly and un-Pythonic.
i + j != nis the proper Pythonic form. I sentence you to read PEP-8
![Idea Idea](https://python-forum.io/images/smilies/lightbulb.png)
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.