Write a function coin_flip that accepts as its parameter an input file name. Assume that the input file data represents results of sets of coin flips that are either heads (H) or tails (T) in either upper or lower case, separated by at least one space. Your function should consider each line to be a separate set of coin flips and should output to the console the number of heads and the percentage of heads in that line, rounded to the nearest tenth. If this percentage is more than 50%, you should print a “You win” message. For example, consider the following input file:H T H H TT t t T h HhFor the input above, your function should produce the following output:3 heads (60.0%)You win!2 heads (33.3%)1 heads (100.0%)You win!The format of your output must exactly match that shown above. You may assume that input file contains at least 1 line of input, that each line contains at least one token, and that no tokens other than h, H, t, or T will be in the lines.

Related

#T7A