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 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
import random def flip if randomrandom 05 return 0 else return 1 def main N in... View full answer
Get step-by-step solutions from verified subject matter experts
