bubble(think so) sort in python programming language

# bubblesort attempted to be ported to python by
# Jeffrin Jose T <ahiliation@yahoo.co.in>
# from bubble.php by # detour@metalshell.com # License : GPL.

 

array_size = 20;

import random
result = []

# hash values of numbers between -5 to 256 are the same as the
# numbers themselves. So, whatever may be the order, set will have them
# in the sorted order. So, `result` cannot be a `set` here.

for x in range (0, 20):
    num = random.randint(0, 20)
    while num in result:
        num = random.randint(0, 40)
    result.append(num)
print result


for x in range (0,array_size):
    for y in range (0,array_size):
        if result[x] < result[y]:
            hold = result[x]
            result[x] = result[y]
            result[y] = hold


for x in range (0,array_size):
    print result[x]