题解 | #提前结束的循环#
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
1.定义列表, 获取x
a = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] x = int(input())
2.循环找到x
for i in a: if i!=x: print(i) continue break
提前结束的循环
https://www.nowcoder.com/practice/b957171b6e974fb0b5dd3ef653624b52
1.定义列表, 获取x
a = [3, 45, 9, 8, 12, 89, 103, 42, 54, 79] x = int(input())
2.循环找到x
for i in a: if i!=x: print(i) continue break
相关推荐