📜  缺少数字 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:34.845000             🧑  作者: Mango

代码示例1
numbers = input("Enter your numbers with ','separated form : ")
int_array = list(map(int,numbers.split(",")))
Sum = 0
for i in range(len(int_array)):
    Sum = Sum+int_array[i]
n = len(int_array) +1
missing = (((n+1) * (n))/2) -Sum 
print(missing)