题解 | #提前结束的循环#
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
l = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] a = int(input()) if a in l: for s in l[:l.index(a)]: print(s) else: for s in l: print(s)
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
l = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] a = int(input()) if a in l: for s in l[:l.index(a)]: print(s) else: for s in l: print(s)
相关推荐