I'm a little angry about requiring a while because Python loops better for loops. But learning is learning!
Think about it. Why While True ? It will never stop without a breakthrough statement, which I think is a little lame. What about another condition?
What about variables? I think you may need two. One for each number you want to propagate. And make sure you add to them in the while .
I am happy to add to this answer if you need more help.
Your logic is pretty good. But here is my resume:
stop the cycle when the product of two numbers is n * n .
At the same time, print each number and its product. If the first number is not equal to n, increase it. After that, n start to increase the second. (This can be done with if statements, but nested loops would be better.) If they are both n, the while block will break because the condition will be met.
According to your comment, here is a little snippet of hued-y psuedocode:
while something: while something else: do something fun j += 1 i += 1
where should the original assignment i and j be performed? Something, something else, and something funny?
vroomfondel
source share