Question
import re from random import randint def rand_list(): ans = list() for i in range(6): ans.append(randint(1, 59)) # print(ans) return ans def comparelist(x, y): z
import re from random import randint
def rand_list(): ans = list() for i in range(6): ans.append(randint(1, 59)) # print(ans) return ans
def comparelist(x, y): z = list(set(x).union(set(y))) if len(z) is len(x): return True return False
l = input('Enter six numbers for the lottery:') l = l.split() try: for a in range(0, len(l)): l[a] = int(l[a]) except: print ('Enter integer values')
l.sort() l = list(set(l)) if len(l) != 6: print ('Invalid input') exit()
for a in range(6): if l[a] 59: print ('Invalid input') exit()
for i in range(1, 9001): rlist1 = randlist() rlist1.sort()
if comparelist(l, rlist1): cost = (i - 1) * 3 + 1 print ('On week ' + i + ', numbers are:' + ','.join(rlist1)) print ('You are a MILLION DOLLAR winner!!') print ('Your total return is $' + str(1000000 - cost)) print ('Total amount spent is $' + str(cost)) exit()
rlist2 = randlist() rlist2.sort() if comparelist(l, rlist2): cost = (i - 1) * 3 + 2 print ('On week ' + i + ', numbers are:' + ','.join(rlist2)) print ('You are a MILLION DOLLAR winner!!') print ('Your total return is $' + str(1000000 - cost)) print ('Total amount spent is $' + str(cost)) exit()
rlist3 = randlist() rlist3.sort() if comparelist(l, rlist3): cost = (i - 1) * 3 + 3 print ('On week ' + i + ', numbers are:' + ','.join(rlist3)) print ('You are a MILLION DOLLAR winner!!') print ('Your total return is $' + str(1000000 - cost)) print ('Total amount spent is $' + str(cost)) exit()
cost = 9000 * 3
print ('Total amount spent is $' + str(cost))
The error is :
plz fix the error.
Enter six numbers for the lottery: 7 14 17 38 44 50 Traceback (most recent call last): Pile "main.py", line 19, inStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started