Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement the functions below in the file hm3 py and submit on the Asss tab on C

ID: 638738 • Letter: I

Question

Implement the functions below in the file hm3 py and submit on the Asss tab on COL a. You must add appropriate doe strings (eg strings that appear on the line following the function header) to the functions that clearly state their types and concisely describe what the fiunctions are doing functions are doing. b. Your submision must include sample runs ofyour program. 1. Implement a function prob) that takes no parameters and enters a positive integer n from the user. The value n represents the number of tosses of a fair coin. The function checks that n is positive0). If it is not, it prints an enror message. Ifn is positive the function that n is positive 0) Ifit is ot. itprints an eror message. Ifn is posive the fuction prints the probability of getting n heads in a row when tossing a coin n times. That probability can be computed as l divided by 2 to the power n. You may assume that the user will eater an integer when prompted. The information below shows how you would call the function prob) and what it would display for several examples:

Explanation / Answer

def prob():
   print ("Enter the number of coin tosses : ")
   n = int(input())
   if (n < 1):
       print ("This is not a valid number of coin tosses ! Good Bye")
   else:
       print ("Probability of n head in n tosses : "+str(1/pow(2,n)))

def printMultiples(a,b):
   for i in range(1,b+1):
       print (a*i,end = " ")
   print ("")