1 #自己的方法 2 num = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] 3 4 x = int(input()) 5 for i in num: 6 if x == i : 7 break 8 else: 9 print(i) 10 11 12 13 14 15 16 17 #网友的方法,很喜欢 if i - n : 这个判断条件 18 l = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] 19 n = int(input()) 20 for i in l: 21 if i-n: #学习这一点 22 print(i) 23 else: 24 break
标签:12,游戏,猜数,int,45,42,num From: https://www.cnblogs.com/bravesunforever/p/17626985.html