Typical Logic Question In Python