Esempio n. 1
0
import sort

print ["Adam", "Henry", "Alex", "Jerry", "Zim", "Paul", "Travis"]
print sort.bubble(["Adam", "Henry", "Alex", "Jerry", "Zim", "Paul", "Travis"])
print [10,5,7,8,2,1,4,34,0,9]
print sort.bubble([10,5,7,8,2,1,4,34,0,9])
print sort.bubble([10,5,7,8,2,1,4,34,0,9], 'rev')
print sort.seq_search('cheese', ['a','b','c','d','cheese'])
Esempio n. 2
0
import sort
import random

nums = [random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26), random.randint(0,26)]
a = sort.seq_search(input("Input a number from 0 to 25. If the number\nis in a list of 10 random numbers in that range, I'll tell you where.\n> "), nums)
if a != None:
	print "Value found at the index of",a
else: print "Value not found..."