Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- #Class for n.2 page 63
- #Takes 2 numbers (nb1= Amount of questions, nb2=Amount of possibilities per questions(options)
- class exo2(object):
- """description of class"""
- def __init__(self, nb1, nb2):
- self.nbq = nb1
- self.nbc = nb2
- def calcul(self):
- chanceWinNbc = 1/self.nbc
- chanceLossNbc = 1- chanceWinNbc
- questionWin = int(round((60*self.nbq) /100))
- questionLoss = self.nbq - questionWin
- total = math.pow(chanceWinNbc,questionWin) + math.pow(chanceLossNbc,questionLoss)
- return total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement