Skip to content

Instantly share code, notes, and snippets.

@saltavenger
Last active October 13, 2015 19:48
Show Gist options
  • Save saltavenger/4247193 to your computer and use it in GitHub Desktop.
Save saltavenger/4247193 to your computer and use it in GitHub Desktop.
probability
import random
def sampleQuizzes():
yes = 0.0
for i in range(10000):
midterm1 = random.randrange(50,81)
midterm2 = random.randrange(60,91)
finalExam = random.randrange(55,96)
finalGrade = midterm1*0.25 + midterm2*0.25 + finalExam*0.50
if finalGrade >= 70 and finalGrade <= 75:
yes += 1.0
return yes/10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment