1 list03 = [3,4,5,4] 2 3 result = False 4 for r in range(0,len(list03)-1): 5 for c in range(r+1,len(list03)): 6 if list03[r] == list03[c]: 7 print('具有相同项') 8 result = True 9 break 10 if result: 11 break 12 if result == False: 13 print('没有相同项')
2024-03-26 15:40:52
1 list03 = [3,4,5,4] 2 3 result = False 4 for r in range(0,len(list03)-1): 5 for c in range(r+1,len(list03)): 6 if list03[r] == list03[c]: 7 print('具有相同项') 8 result = True 9 break 10 if result: 11 break 12 if result == False: 13 print('没有相同项')