Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import math
  2.  
  3. #Class for n.2 page 63
  4. #Takes 2 numbers (nb1= Amount of questions, nb2=Amount of possibilities per questions(options)
  5. class exo2(object):
  6. """description of class"""
  7. def __init__(self, nb1, nb2):
  8. self.nbq = nb1
  9. self.nbc = nb2
  10.  
  11. def calcul(self):
  12. chanceWinNbc = 1/self.nbc
  13. chanceLossNbc = 1- chanceWinNbc
  14. questionWin = int(round((60*self.nbq) /100))
  15. questionLoss = self.nbq - questionWin
  16. total = math.pow(chanceWinNbc,questionWin) + math.pow(chanceLossNbc,questionLoss)
  17.  
  18. return total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement