subject

Me write this code!
starting small
to start, we're going to simulate flipping a coin 10 times. you might be thinking that isn't many coin flips, and that we could just do those flips in real life, but this is actually an important step in developing a simulation. at small scales we can make sure our code is working as intended because we can still visually confirm its output. once we're convinced that the logic of our program is reliable we'll move up to simulating larger numbers of flips.

the core logic of our program will be focused on a while loop that simulates flipping a coin by repeatedly generating random 0's or 1's using randomnumber. this is a great opportunity to keep practicing using loops while applying your knowledge of variables, iteration, and if statements.

do this:
when we want to flip a coin with a computer we will instead generate a random number between 0 and 1.
write a program that uses a while loop to flip a coin 10 times and writes the value of each flip to the screen. the example below shows how your program should run.
hint: you will need to use a counter variable in your while loop to keep track of how many times the coin has been flipped.

ansver
Answers: 3

Another question on Advanced Placement (AP)

question
Advanced Placement (AP), 24.06.2019 04:00
Astudent is revising the sentence below: i know brendan was upset, but i feel he overreacted. you would have thought he'd just lost his best friend, the way he would bemoan his fate. based on the context of this sentence, which is the best synonym for bemoan? a. complain: express dissatisfaction or annoyance b. grieve: cause distress to someone c. nag: annoy with persistent fault-finding d. provoke: stimulate or incite
Answers: 1
question
Advanced Placement (AP), 25.06.2019 11:00
Which are the apprehensions of the consumers who shop online? consumers who shop online enjoy the convenience of shopping from home but are apprehensive about theft and loss of privacy.
Answers: 1
question
Advanced Placement (AP), 26.06.2019 10:30
Which control would most likely achieve the greatest reduction of noise pollution? limiting airplane traffic insulating buildings and homes reducing road and highway traffic using headphones to listen to music building noise barriers beside highways
Answers: 1
question
Advanced Placement (AP), 26.06.2019 18:00
Let r(t) represent the rate, in square feet per minute, at which a groundskeeper is mowing a lawn t minutes after 3 p.m. what expression represents the area, in square feet, of the lawn that is mowed between 3 p.m. and 5 p.m.?
Answers: 1
You know the right answer?
Me write this code!
starting small
to start, we're going to simulate flipping a coin 1...
Questions
question
Mathematics, 25.04.2020 23:50
question
World Languages, 25.04.2020 23:50
question
Mathematics, 25.04.2020 23:50
Questions on the website: 13722362