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
ira [324]
3 years ago
14

Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is

either heads or tails. Assume the input is a value greater than 0.
Computers and Technology
1 answer:
Nataly [62]3 years ago
7 0

Answer:

import random

decisions = int(input("How many decisions: "))

for i in range(decisions):

   number = random.randint(0, 1)

   if number == 0:

       print("heads")

   else:

       print("tails")

Explanation:

*The code is in Python.

import the random to be able to generate random numbers

Ask the user to enter the number of decisions

Create a for loop that iterates number of decisions times. For each round; generate a number between 0 and 1 using the randint() method. Check the number. If it is equal to 0, print "heads". Otherwise, print "tails"

You might be interested in
A CPU scheduler that assigns higher priority to the I/O-bound processes than the CPU-bound processes causes:
Sholpan [36]

Answer:

Low CPU utilization and high I/O utilization

Explanation:

6 0
2 years ago
Which sequence represents the hierarchy of terms, from smallest to greatest?
Anni [7]

Answer:

b

Explanation:

7 0
3 years ago
Mr. Yang is a doctor who regards video games as an effective means of staying fit. What type of game would he recommend to his p
LUCKY_DIMON [66]

wii sports, just dance, etc.

Explanation:

3 0
3 years ago
write a loop that reads positive integers from stands input and that terinated when it reads an interger that is not positive af
gtnhenbr [62]

Loop takes only positive numbers and terminates once it encounters a negative numbers.

Answer and Explanation:

Using javascript:

Var positiveInt= window.prompt("insert positive integer");

While(positiveInt>=0){

Alert("a positive integer");

Var positiveInt= window.prompt("insert positive integer");

}

Or we use the do...while loop

Var positiveInt= window.prompt("insert positive integer");

do{

Var positiveInt= window.prompt("insert positive integer");

}

While (positiveInt>=0);

The above program in javascript checks to see if the input number is negative or positive using the while loop condition and keeps executing with each input until it gets a negative input

5 0
3 years ago
Write a paragraph expressing how you'd use the computer to enhance your place of work.​
Charra [1.4K]

Answer:

Have water by, have it organized, and have notes by you welcome.

Explanation:

4 0
4 years ago
Other questions:
  • In the windows firewall, any rules preceded by a __________ checkmark have not been enabled. black gray green red
    13·1 answer
  • Which feature of the Excel window should I use to perform an action
    11·1 answer
  • What will the following program display?
    15·1 answer
  • Given positive integer numinsects, write a while loop that prints that number doubled without reaching 100. follow each number w
    10·1 answer
  • What are the functions of online gaming communities?
    12·1 answer
  • What are the different ways to represent compounds? Check all that apply. a structural formula a ball model a space-filling mode
    13·2 answers
  • Please help with attached file
    8·2 answers
  • The first idea for a communications network was called
    14·2 answers
  • Write a Python program that inputs an integer between 0 and 1000 and adds all the digits in the integer. For example, if integer
    6·1 answer
  • Mario is giving an informative presentation about methods for analyzing big datasets. He starts with the very basics, like what
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!