(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)
posted @ 2024-02-02 22:09  Kazuma_124  阅读(38)  评论(0)    收藏  举报