Reputation: 37
The user need to input space separated values and finally the enter button to submit. I have tried the below code but can't restrict to only 10 inputs. for eg- first ask for number of inputs. Then followed by the ten inputs whichare space separated in single line.
#input in single line separated by space(Python3).
n=int(input())
a=[int(x) for x in input().split(), range(n))]
Upvotes: 0
Views: 46
Reputation: 1236
Simply :
if len(a) != 10:
print("len is not correct")
else:
print("good")
Upvotes: 1