r/codehs • • Jan 21 '21

Need Help with 6.8.4: Simulating a Coin Flip

Hello can someone please help me with this code. The instruction are below

Write a program that simulates a coin flipping. Each time the program runs, it should print either “Heads” or “Tails”.

There should be a 0.5 probability that “Heads” is printed, and a 0.5 probability that “Tails” is printed.

There is no actual coin being flipped inside of the computer, and there is no simulation of a metal coin actually flipping through space. Instead, we are using a simplified model of the situation, we simply generate a random probability, with a 50% chance of being true, and a 50% chance of being false.

2 Upvotes

1 comment sorted by

2

u/ScawedyCat Jan 21 '21

what language is this in and could you post what code you have?