0
how to enter range of numbers at a time in single line of list
10 Réponses
+ 1
numbers = list(map(int, input().split()))[:6]
+ 1
the number in square brackets indicates the number of elements to enter
0
var = list(range(x1, x2))
0
User has to enter list of elements
0
Eg:-i/p:-n=5
I/p:-6 1 9 5 4
How to take range of elements input at a single line
0
KRID Indu Do you mean to construct a list with the range supplied by the user? In that case, you can use int(input()).
0
Else, if your intention is to find out the range of a set of numbers, you can use the min()/max() function.
0
Nope
0
L=[int(x) for x in input().split()]
-->any number of integers intake
But i want to take elements according to user requirement like
L=[int(x) for x in range(6).input().split()]-->but its not working
0
This 6 elements user has to enter seperated by spaces like
8 7 4 5 0 7 8