result = [None] * k
setsize = 21 # size of a small set minus size of an empty list
if k > 5:
TypeError: can't multiply sequence by non-int of type 'float'
If this line is producing the error then it's obvious.
k is a float and you can't multiply a list with a float. So, if you cast your float k to int, the code runs without error.
k = int(k)
result = [None] * k
setsize = 21 # size of a small set minus size of an empty list
if k > 5:
random.py was Pythons random.py and changing that wouldn't be the best of ideas. If the OP called his own file random.py your answer will help, but I'd strongly suggest not to use this file name.
randomtoo.