i have to write a program that simulates the flipping of a coin.
1. the function should ask the user how many times the coin should be flipped
2. the program should display the poportion of times that the head and tails appeared. (for example if the user enters 10 and 53 of the them are heads. the program should output 'heads' 0.53, 'Tails' 0.47.
3. the program should have four functions main,input,flip,display, and they should call each other to display the answer
this is my code at the moment in time
import random
def main():
userInput = getInputs()
def inputs():
userInput = int(raw_input("Number of times to flip the coin: ")
def flips(userInput):
heads = 0
tails = 0
counter = 0
while counter < userInputs:
if randon.randrange(0,2)
heads += 1
if heads > 0
print displayResluts()
def results():
return simlatefilps()
I am wonder if I am writing the code in the right format. Can someone help me find a solution too if possible.