Home > Back-end >  Python: random integer within 10 100, looking for business value is the smallest two integer.
Python: random integer within 10 100, looking for business value is the smallest two integer.

Time:05-20

Pray god help me answer the urgent urgent!!!!!!

CodePudding user response:

 
Import the random
Origin_list=[random randint (0, 99) for I in range (10)]
Print (" random integer within 10 100 is ", origin_list)
Origin_list. Sort ()
- origin_list dif_list=[[origin_list [I] [I - 1), (origin_list [I], origin_list] [I - 1)] for I in range (1, len (origin_list)]
Dif_list. Sort (key=lambda x: x [0])
Result=[I [1] for I dif_list in the if I [0]==dif_list [0] [0]]
Print (" the difference is the smallest number two: ", the result of ", the difference is: ", dif_list [0] [0])

CodePudding user response:

This is a C/C + + plate, you use the python? C language can be achieved