華為機試題不用while true:通不過,下面運行出來結果是一樣的,想知道原因?
while True:
try:
n = int(input())
s = set({})
for i in range(n):
s.add(int(input()))
nums = list(s)
nums.sort()
for i in nums:
print(i)
except:
break
和
n = int(input())
s = set({})
for i in range(n):
s.add(int(input()))
nums = list(s)
nums.sort()
for i in nums:
print(i)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/235754.html
上一篇:匯編語言判斷字串
