题解 | #提前结束的循环#
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
定义列表与接收数据的变量
element = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] num = int(input())
使用for循环进行数字判断
for i in element: if num != i: print(i) else: break
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
element = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] num = int(input())
for i in element: if num != i: print(i) else: break
相关推荐