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]
2 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]2 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
The ____ operation is used to add an element onto the stack.
Mariulka [41]
A. the answer is push :) pop is when you take away
8 0
3 years ago
Sarah is creating and formatting a newsletter for her school. Which page layout rules should she consider when doing this?
lorasvet [3.4K]
Hey!

I believe the answer to 1. Should be A. Rule of Thirds.
6 0
3 years ago
Read 2 more answers
Physical Geography of the Middle East
vagabundo [1.1K]

Answer:

Explanation:

He’s wright SS7G5 The student will locate selected features in

Southwestern Asia (Middle East).

a. Locate on a world and regional political-physical map:

Euphrates River, Jordan River, Tigris River, Suez Canal,

Persian Gulf, Strait of Hormuz, Arabian Sea, Red Sea, and

Gaza Strip.

b. Locate on a world and regional political-physical map the

nations of Afghanistan, Iran, Iraq, Israel, Saudi Arabia, and

Turkey

3 0
2 years ago
A(n) ___ operating system is a very fast, relatively small os. it is designed to respond to hardware and program requests almost
nataly862011 [7]
<span>A real-time operating system is a very fast, relatively small os. it is designed to respond to hardware and program requests almost instantly.</span>
3 0
2 years ago
I'm trying to network two laptops together using ethernet cable but it isn't working. Why isn't it working
Nonamiya [84]

On modern network cards, this should just work.

It is advisable to give each laptop its own fixed IP address, such as 192.168.1.1 and 192.168.1.2 (with a netmask of 255.255.255.0)

However, you need to define what you expect to work. The first thing to try is ping <em>the other</em> machine from the command prompt, e.g.:

C:\> ping 192.168.1.2

Then, you can try to access shared network drives if you have enabled that. In the file explorer, try typing: \\192.168.1.2

5 0
3 years ago
Other questions:
  • The exercise instructions here are long -- please read them all carefully. If you see an internal scrollbar to the right of thes
    15·1 answer
  • What is a quick way to close the header or footer view in a microsoft word document?
    12·1 answer
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • Technician A says that front and rear U-joints on a RWD axle should operate at different angles to prevent vibration. Technician
    10·1 answer
  • Tom's Art Supplies used to sell art supplies through mail order catalogs, but the company's order takers often had difficulty de
    9·1 answer
  • Tara is creating a presentation for her science project about volcanoes. She added different animations to every slide for empha
    12·1 answer
  • The metric unit used for length
    5·1 answer
  • The most important preinstalled software is the ______ software that allows you to use the computer the first time you turn it o
    7·1 answer
  • Mention and discuss specific professional ethics related to augmented reality, artificial intelligence, and the internet of thin
    6·1 answer
  • To optimize the flow of data into and out of the cpu, the modern mcc provides at least _______________ of data every time the cp
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!