Enter a list , Each of these elements is 0~9 Integer between , Output an integer consisting of all elements of the list sorted in ascending order .
Enter a list , Each of these elements is 0~9 Integer between .
Output an integer consisting of all elements of the list sorted in ascending order .
[5, 4, 7, 4, 1]
14457
a=eval(input()) a.sort() sum=0 for i in a: sum=sum*10+i print(sum)
Enter the second list , In the list 1 Middle list 2 Delete some elements in .
Input list 1 And list 2.
Output the processed list 1
[1,2,3,1,4] [3,1,5,3,6]
[2, 4]
a=eval(input()) b=eval(input()) c=[i for i in a if i not in b] print(c)
Enter a list of integers , Find the subscript of the largest element in the integer list , If the maximum number of elements exceeds 1, Then please print out all subscripts .
Numbers 1, Numbers 2, Numbers 3,...., Numbers n
Subscript 1 Subscript 2 ... Subscript k
3,2,3
0 2
a=list(map(eval,input().split(","))) b=max(a) for i in range(0,len(a)): if a[i] == b: print(i)
They don't want to talk to you , And threw a bunch of numbers at you …… And you have to find it in this string of numbers “250” This touching number on the big .
Input the number of absolute values in a row that do not exceed 1000 The integer of .
Output the last occurrence in one line “250” It's the number that they threw ( Count from 1 Start ). If not “250” The number of , Output is 0.
888 666 123 -233 250 13 250 -222
7
a=list(map(eval,input().split(" "))) b=0 for i in range(0,len(a)): if a[i] == 250: b=i if b==0: print(b) else: print(b+1)
Enter a include 10 individual 100 A list that does not repeat any number within , This list , Use sort function sorted() Generate a new list , Odd numbers come first and even numbers come last in the new list , And the relative order between odd numbers remains the same , The relative order between even numbers also remains the same .
list
Sorted list
[2,6,45,9,34,10,91,62,36,18]
[45, 9, 91, 2, 6, 34, 10, 62, 36, 18]
temp=eval(input()) a=[] b=[] for i in temp: if i%2==1: a.append(i) else: b.append(i) print(a+b)