On 2018-07-23, no@none.invalid wrote:
> never mind.
> x = range (5)
> y = range (5)
> for ply in x:
>
> for com in y:
> if ply==com:
> result="Tie"
>
> print(ply,com,result)
> result = ""
Something like this is possible. "x", "y" and "result" can be
What if ply != com in the first (0th) iteration?
It's better to have an 'else:'-statement in your case, I suppose.
--
https://mail.python.org/mailman/listinfo/python-list
no@none.invalid writes:
> never mind.
Congratulations for working out the error. And thank you for returning
to show the corrected code :-)
--
\ “If you don't know what your program is supposed to do, you'd |
`\ better not start writing it.” —Edsger W. Dijkstra |
_o__)
x = range (5)
y = range (5)
for ply in x:
for com in y:
if ply==com:
result="Tie"
print(ply,com,result)
Why is ply always equal to com?
0 0 Tie
0 1 Tie
0 2 Tie
0 3 Tie
0 4 Tie
1 0 Tie
1 1 Tie
1 2 Tie
1 3 Tie
1 4 Tie
2 0 Tie
2 1 Tie
2 2 Tie
2 3 Tie
2 4 Tie
3 0 Tie
3
never mind.
x = range (5)
y = range (5)
for ply in x:
for com in y:
if ply==com:
result="Tie"
print(ply,com,result)
result = ""
On Sun, 22 Jul 2018 23:17:24 -0400, no@none.invalid wrote:
>x = range (5)
>y = range (5)
>for ply in x:
>for com in y:
>