Python code that needs some overview

Posted by fabio on Stack Overflow See other posts from Stack Overflow or by fabio
Published on 2009-05-26T07:02:10Z Indexed on 2010/03/19 13:51 UTC
Read the original article Hit count: 290

Filed under:

Hi guys, im currently learning python (in the very begining), so I still have some doubts about good code manners and how should I proceed with it.

Today I created this code that should random trought 01 to 60 (but is running from 01 to 69)

import random

dez = ['0', '1', '2', '3', '4', '5', '6']
uni = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
sort = []

while len(sort) <= 5:
    random.shuffle(dez)
    random.shuffle(uni)
    w = random.choice(dez)
    z = random.choice(uni)
    chosen = str(w) + str(z)
    if chosen != "00" and chosen not in sort:
        sort.append(chosen)
    print chosen

I'm also in doubt how to make the code stop at "60".

© Stack Overflow or respective owner

Related posts about python