Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Epic
#python 2.7.12 print "Hello, world!" list = [3, 1, 16, 14, 18, 5] # we keep sorting until we reach the end of the list for i in xrange(len(list)): minimum = i # find a number stored smaller than the minimum for j in xrange(i + 1, len(list)): # if we find a smaller one, store that to the minimum if(list[j] < list[minimum]): minimum = j #swap the new one we found with the number at the front temp = list[i] list[i] = list[minimum] list[minimum] = temp """selection sort""" import random list = [] for k in xrange(0,10): num = random.randint(1,100) list.append(num) print(list) print(" ")
run
|
edit
|
history
|
help
0
Filter dictionaries with specific keys (using list comprehension)
p1
pi1
Filter dictionaries with specific keys
1 code
Dictionary comprehension - convert to lowercase
Defining
Dictionary - convert to lowercase
gameboy
20/2