+ 1
How to get a max no . in a list??
User input a long list and result the max no. In the list and also want place of that no. Anyone plz explain
4 Answers
+ 3
max (name of the list) to 'get the Max no. The position you 'get it with index[Max no].
+ 2
It works for range 0-9 but it doesnt recognise the numbers bigger than 9... thats for the definition of the Split i think
+ 2
the problem is the Input. when you get an Input is string type and you can convert it to float or integer but if you give more than one inputs automatly Python creates a list of strings and you can convert the list in a float or integer type.
i think thats the reason for not to run for numbers bigger than 9...
+ 1
Here's the full code:
a=input()
b=a.split(" ")
c=max(b)
d=b.index(max(b))
print("The highest number is: ",c)
print("It's place in the list is: ",d+1)