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.

Answers

Answer 1

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"


Related Questions

On what date was jschlatt originally added to the dreamsmp server, and on which date was his second appearance on the server?

Answers

since this has already been answered, who is your favorite SMP character?

mines Wilbur/ Ghostbur

some people will disagree with me but jshlatt is one of my favorite characters on the dream smp . But my all time favorite characters is ALL of Wilbur's characters

Other Questions
Which idea is found in both "Early Summer Morning" and "How to Release LadybugsInto the Garden"? O Pesticides are dangerous to ladybugs. O It is difficult to get ladybugs to eat aphids. O Ladybugs encounter a variety of dangers. O It is challenging to capture ladybugs in gardens. Part 1 and 2 answers? orphans lonely beginnings reveal how parents shape a childs brain, part a which of the following identifies the main idea of the text Give me I will in a sentence plsss The differing meanings of "valid inference" and "warranted inference" are closely related to the differing purposes of deductive and inductive arguments the purpose of deductive being to prove; the purpose of inductive to make the conclusion most probable. Look up the words "valid" and "warranted." Each of these words, you will find, has what is known as a lexical definition that is just the dictionary definition of the word. Words also have a certain connotations - meanings that go beyond their lexical definitions; associated ideas and concepts think of terms such a "fur baby" as the name for a pet. Required:Briefly discuss how the lexical definitions and connotations of "valid" and "warranted" can help us understand the differing purposes of deductive and inductive arguments. If an object is moving with constant acceleration, its velocity must achange by varying amounts depending on its speed. balways decrease. cbe constant also. dchange by the same amount each second. please will give brain Which sentence best describes the effect of the Declaration of Rights?A. It gave Parliament the right to elect a successor when a monarch died.B. It ensured that no monarch could rule without Parliament.C. It guaranteed all people the rights to liberty and property.D. It defined the rights of the officials of the Church of England. which one of the following is a derived Si unit a. Newton, b. Meter, c. Mole, d. Kiogram Suppose a line segment whose endpoints are T(x1,y1) and U(x2,y2) is reflected over y=x to create TU . The coordinates of the image are T(4, 3) and U'(1, 7) . What are the values of x1 , x2 , y1 , and y2 ? can someone pweaseee help me on this ?? republican's views on national debt Why did people follow Christianity Its kind of like Skype, only without the video (paragraph 6). How does the quoted passage contribute to the development of idea in the text Which two characteristics are used to classify stars on the Hertzsprung-Russell diagram?A. size and densityB. density and compositionC. composition and temperatureD. temperature and absolute brightnessDoes anyone know this answer? which expression is equivalent to 0.17w + 0.77 + w? -0.77 + 1.17w -0.17w + 1.77 -1.94w -1.6w The diagram of a living room is shown below. What fraction of the living room is covered by the rug? need done ASAP Hong needs to memorize words on a vocabulary list for Spanish class. He has memorized 30 of the words, which is five-sixths of the list. How many words are on the list? Write a summary capturing what you see in the painting. "Landscape with the Fall of Icarus" Will someone plz give me brainiliest????????????????????????