Why does this 'if' give results which it's not suppose to?!



When I execute this code it just simply uses all of values that it takes without any filtering. What is going on?

Second 'if' is supposed to ignore numbers that are bigger then 'start_limit'. In one of situations:
ship['length'] = 4
The variable 'place' is a list with two integers, each can be 0-9. So basically this part of function should filter only values of variable 'place' with integer 0-6 at index 1.

dice = 0 # debug
start_limit = 10 - ship['length']
    if dice == 0:
        for place in pc_list_of_available_places: # filters places within the board
            if place[1] <= start_limit:



Can you post whole code?


Yes, you are right. I've already found the solution.
The problem was right after this peace of code. I had another "if" with .append() and it had the same indent as this one:

but when I made additional indent it has got into previous "if" and started to append only correct values.
But thanks anyway for your answer.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.