1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
V125BC [204]
3 years ago
10

A lottery ticket contains five unique numbers. A set of unique numbers does not contain repeated elements. The winning combinati

on of this lottery is chosen by picking five unique numbers. Define a function matches(ticket, winners) that takes two lists and returns an integer that says how many numbers the two lists have in common.
Computers and Technology
1 answer:
RSB [31]3 years ago
6 0

Answer:

Answer explained below

Explanation:

I have given two approaches in implementing the solution.

1. Using the for loop, in which you have to iterate over all the elements in list 1 and check in list 2

2. Use the set intersection method. As intersection will give u the common elements. And we can get there length by using len method.

I have added the code along with the snapshot and inline comment for the ease of you to understand. Please check the methods below. You can use either of them.

METHOD-1:

********** CODE *****************

def matches(tickets,winner):

tickets = set(tickets)

winner = set(winner)

counter = 0 #To Count the common elements

for i in tickets: # Iterate over all the elements in tickets.

if i in winner: # Check the element in the winner list

counter = counter+1

return counter

METHOD -2:

********** CODE ********************

def matches(tickets, winner):

tickets = set(tickets)

winner = set(winner)

return len(tickets.intersection(winner))

You might be interested in
Extension: Cash Register Program
Evgesh-ka [11]

Answer:

hee hee 4 you are correct

Explanation:

6 0
3 years ago
How do u friend people
Verdich [7]
You click on the three dots and click the person silhouette with the plus sign on it.
4 0
3 years ago
Read 2 more answers
After you have been working out for a month, should your Resting Heart Rate increase or decrease?
Ipatiy [6.2K]

Answer:

Your resting heart rate will decrease as your heart becomes stronger through

Explanation:

8 0
3 years ago
Let's consider a long, quiet country road with houses scattered very sparsely along it. (We can picture the road as a long line
Rus_ich [418]

Answer:

Follows are the solution to these question:

Explanation:

A simple gullible algorithm is present. Let h mark the house to the left. Then we put a base station about 4 kilometers to the right. Now delete and repeat all the houses protected by this base station. In this algorithm, they can simply be seen to position baselines at b1, . . , bk as well as other algorithms (which may be an optimum algorithm) at b'_{1}, \ . . . . . . ,b'_{k'}  and so on. (from left to right)   b_1 \geq b'_{1},\ \  b_2 \geq b'_{2} That's why k \leq k'.

7 0
3 years ago
Describe the conventional method of data processing​
andreyandreev [35.5K]

Answer:

The data processing is broadly divided into 6 basic steps as Data collection, storage of data, Sorting of data, Processing of data, Data analysis, Data presentation, and conclusions. There are mainly three methods used to process that are Manual, Mechanical, and Electronic.

4 0
2 years ago
Read 2 more answers
Other questions:
  • Why might you need to convert a file to another file type
    11·1 answer
  • What is the lowest and highest address of a 2^20 byte memory, if it is byte readable.
    11·1 answer
  • Which of the following is not a common network architecture type?
    9·1 answer
  • A(n) ________ software installation enables you to decide which features you want to install on the hard drive. Select one: A. f
    10·1 answer
  • Why might your digital footprint be important when you are applying for collage
    13·1 answer
  • The inability of BAE Automated Systems to create an automated baggage handling system led to a significant delay in the opening
    10·1 answer
  • 1. What makes discrimination different from harassment? (Don't give me definitions.)
    5·1 answer
  • (TCO B) The symbol shown as a three-sided box that is connected to the step it references by a dashed line is what?
    12·1 answer
  • A central issue of public sharing is:
    13·2 answers
  • Which of the following is NOT a reason we use subprograms?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!