import random
print 'Red balls and blue ball are created program!' a = raw_input('Do you want to create numbers?(Y/N)') list1 = ['y','Y',] list2 = ['n','N',] if a in list2: print 'Quit program,please rerun!' else: if a in list1: redList = set() bullList = set() while len(redList)<7: redList.add(random.randint(1,34)) while len(bullList)<1: bullList.add(random.randint(1,17)) print 'Red balls are:',list(redList),'Blue ball is:',list(bullList) else: print 'Only input y or n'