if __name__ == '__main__':
strSize = input()
inpt = input()
strArrSize = strSize.split()
if (len(strArrSize) ==2):
n = strArrSize[0]
m = strArrSize[1]
inptArray = inpt.split()
print(n)
print(len(inptArray))
if (n == len(inptArray)):
print("true")
else:
print("Given " + str(n) + " integers but entered " + str(len(inptArray)))
else:
print("Invalid itnput. The first line must have two space seperated integers.")
这是我得到的输入和输出。
PS S:\Study\CH1> python tt.py
1 2
1
1
1
给定 1 个整数但输入 1