This little code shows 6 random integer numbers from 1 to 50 ...

`import random print "show 6 random integers from 1 to 50:" for k in range(6): r = random.randint(1, 50) print r, print`

Rewrite the code to make sure there are no duplicate numbers amongst the six numbers displayed.

Now let the user enter six unique numbers from 1 to 50 and then count how many tries it takes the computer to match 3, 4, 5 or 6 of the user's numbers, using the above random number example. You might recognize this as a way to figure out the chances to win a lotto game.

Not sure if this is the place to ask but I want to write a similar program that list all possible combinations and have it displayed in the Notepad program. Where do I start? And how do I write a search program (with parameters that I set) that filters the results?

Thanks!

Editor's Note:

This question has been moved to the forum from Projects for Beginners.

Sorry, the title should really be **combinations**