Question: Write a program that simulates coin tossing. Let the program prompt the user to enter the number of tosses N and count the number

Write a program that simulates coin tossing. Let the program prompt the user to enter the number of tosses N

Write a program that simulates coin tossing. Let the program prompt the user to enter the number of tosses N and count the number of times each side of the coin appears. Print the results. The program should call a separate function flip() that takes no arguments and returns 0 for tails and 1 for heads. The program should produce different results for each run. Sample Input/Output Enter the number of tosses N: 1000 The total number of Heads is: 495 The total number of Tails is: 505

Step by Step Solution

3.31 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import random def flip if randomrandom 05 return 0 else return 1 def main N in... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!