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
Levart [38]
3 years ago
10

Write a program which simulates the result of a person choosing 3 objects in a random order out of a box containing 3 objects in

total. The box contains the following 3 objects: apple, ball, cat. A single selection pass of your program describes the random selection of 3 objects out of the box, without replacement. This means that a particular object can only be selected from the box once. At the beginning of a pass, the box is full, so it contains all 3 objects. After an object is selected from the box, your program will print the name of the object and then choose another object without replacing the previous object. The selection process repeats 3 times until the box is empty
Computers and Technology
1 answer:
Leviafan [203]3 years ago
6 0

Answer:

Explanation:

The following code is written in Python, it loops through a list (box) of the objects and randomly choosing one of the objects. Prints that object out and removes it from the list. Then repeats the process until the box is empty.

import random

box = ['apple', 'ball', 'cat']

print(box)

for x in range(len(box)):

   pick = random.randint(0,len(box)-1)

   print("Pick " + str(x+1) + ": " + box[pick])

   box.remove(box[pick])

print(box)

You might be interested in
Why can’t I “change the country” on settings??<br> (In this app)
Serjik [45]
I don't think it has an option to change your country. If you'd like to see things in a different language, that's probably a different story.
7 0
3 years ago
Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
kotykmax [81]

Are there any options

3 0
4 years ago
Read 2 more answers
List 1 reason people invest in Cryptocurrency
Katarina [22]

Answer:

The common reason to invest in cryptocurrency is the desire for a reliable, long-term store of value.

Explanation:

8 0
2 years ago
Given this method comment, fill in the blank in the method implementation. /* Deposits money into the bank account amount: the a
DIA [1.3K]

Answer:

"void" is the correct answer for the given question.

Explanation:

In the function body the value of balance variable is not return that means we use void return type .The void return type is used when the function does not return any value .

If the function are  int return type that means it return "integer value ".

if the function are  double return type that means it return the "double value" .

The complete implementation of this method is

public void deposit(double amount) // function definition  

{

balance = balance + amount; // statement

}

3 0
3 years ago
Why are computer simulations useful in studying phenomena in the universe?
amid [387]

Answer:

Explanation:

Computer simulations are helpful because they can handle the computation of a big number of variables, at the same time. The universe is a constantly changing place with many different variables changing other variables. Thus, a computer is ideal to simulate, or predict, real life phenomena because of its processing power.

7 0
2 years ago
Other questions:
  • is a specific system for gathering information from a single group of respondents by continuously monitoring the advertising, pr
    13·1 answer
  • What lie does E.D. tell to keep the musical from being canceled? There is a television crew coming to do a story on it. Jake wil
    6·1 answer
  • Which security control is most helpful in protecting against eavesdropping on wireless LAN (WLAN) data transmissions that would
    6·1 answer
  • Define a romanNumberToInt function that converts a RomanNumber value, which is a list of Roman digits, into an integer. Hints: -
    7·1 answer
  • What is the difference between head header and heading in HTML​
    8·1 answer
  • What is the gauge manifold made of
    14·1 answer
  • How do you respond to an email?
    6·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
  • Please describe the role of games in modern society!
    5·2 answers
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!