Why array.sort() showing error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why array.sort() showing error?

from array import* n = int(input()) array = [int,input ().split( )] array.sort() print(array)

16th Dec 2021, 1:03 PM
Nisha
3 Answers
+ 2
You probably meant to split input string and convert each element into int. array = list( map( int, input().split() ) )
16th Dec 2021, 2:09 PM
Ipang
+ 1
n = input().split() n.sort() print(n)
16th Dec 2021, 1:23 PM
Ashwini Adsule
Ashwini Adsule - avatar
0
Galaxy Don't i need to mention n input sould be integer?
17th Dec 2021, 3:56 AM
Nisha