(python)每日代码||2024.2.2||python当中,True==1竟然引发了问题
做题的时候有的测试点里竟然用True替换1,骗过了我的代码,结果没过测试点
lst = [1, True]
for item in lst:
if not isinstance(item, bool) and item == 1:
print(item)
做题的时候有的测试点里竟然用True替换1,骗过了我的代码,结果没过测试点
lst = [1, True]
for item in lst:
if not isinstance(item, bool) and item == 1:
print(item)