Answer the question
In order to leave comments, you need to log in
How to correctly determine lottery tickets in accordance with the conditions of the problem?
Good evening!
It remains for me to almost finish solving the problem in Python using algorithms, the conditions of which you will see in the screenshots at this link.
The code is written almost correctly, the initial data was processed by the program in accordance with the conditions for solving the problem. And there is a small error in the results:
Instead of displaying the correct result:
Unlucky
Lucky
Lucky
Lucky
Lucky
Unlucky
Answer the question
In order to leave comments, you need to log in
And I'm not satisfied with the "only" problematic piece of code:
if ndata[i] % 2 != 0 and nf % 2 != 0: lucky += 1
There is some kind of nonsense written there. What's with the parity check?
You need to count how many numbers from trda are in ndata and print Lucky if you counted at least 3 (reread the problem statement).
Accordingly, it should be something like
if nf == ndata[s]: cnt+=1
...
if cnt >=3: print('Lucky')
else: print('Unlucky')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question