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
Functions of barriers include (mark all that apply): A. Define boundaries B. Design layout C. Deny access D. Delay access
gayaneshka [121]

Answer:

A. Define boundaries

C. Deny access

D. Delay access

Explanation:

A barrier is a material or structure used to prevent or block access. Barriers can either be natural or structural and are used for many purposes usually for security reasons. The following are functions of barriers either natural or structural:

  1. Define areas of boundaries
  2. Delay or slow access. Example is the use of speed bumps to slow down vehicles.
  3. Provide access to entrances such as the use of gates
  4. Deny access to unauthorized personnel and allowing authorized personnel.
4 0
3 years ago
During which step of the problem-solving process would group members combine and elaborate on ideas? Define the problem. Analyze
slava [35]

In a problem-solving process occurring inside a group, (C) develop creative solutions would be where the members combine and elaborate on ideas.

Brainstorming would be a prominent feature during this process since group members would be encouraged to state her or his opinion and solutions about the problem that the group needs to solve.

5 0
3 years ago
What is a variable?
aleksandr82 [10.1K]
Answer. D: a value that looks loads when the program runs.


Explanation:

In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction s that tell the computer what to do and data that the program uses when it is running.
5 0
3 years ago
The OnStar system allows Select one: a. a vehicle owner to initiate a conversation with an OnStar representative. b. the vehicle
Rzqust [24]

Answer:  e) a, b, and c

Explanation: OnStar system is the secondary service that is provided by the General Motor Corporation , who is the parent company of this system.The services like in-vehicle protection, diagnosing issues from distance emergency services, communication services based on subscriptions, turn by turn navigation etc.

Conversation started with OnStar member by vehicle owner is communication service in hands -free way, vehicle sending message to OnStar member after mishap/accident is type of emergency services and OnStar member putting off the gas pedal without the permission of driver of the the vehicle is also a protect service .Thus, all the given options are correct.

6 0
2 years ago
In Vista and Windows 7, the Appearance and Personalization option allows you to change the
svetoff [14.1K]
Answer= background
Appearance of the laptop is called theme, it is also related to background
5 0
2 years ago
Other questions:
  • Steve is proofreading his memo and he notices that he has typed a phrase twice. Steve should _____.
    5·2 answers
  • Write an expression that executes the loop body as long as the user enters a non-negative number.Note: If the submitted code has
    11·1 answer
  • Which of the following controls will provide an area in the form for the user to enter a name? a. button b. label c. text box d.
    8·1 answer
  • We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start ou
    14·2 answers
  • Which app or website teaches java and phyton
    15·1 answer
  • Pls explain the meaning of the word"INTERNET"​
    5·2 answers
  • Pls help now the question is very hard someone help me pls​
    6·1 answer
  • What goes in between the < > when declaring a new ArrayList?
    14·1 answer
  • How do we prevent electrical problems as prescribe by the course?​
    11·1 answer
  • What is not recyclable in a<br> hybrid car<br> hydrogen car<br> petrol car
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!