id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav1780@gmail.com 03_loops > min_purchases_required
prev  |  next  |  chance

Disclaimer: Math-heavy question ------ A company has come up with a promotion where customers have a 1 in n chance of winning a prize (for every product purchased). n is in the range from 1 to 50. Define a function that when passed the value of N, returns the number of products a customer must purchase to have a p% (p is a value between 0 and 100) or greater probability of winning at least one prize.


min_purchases_required(4, 40) → 2
min_purchases_required(10, 50) → 7
min_purchases_required(1, 99) → 1

...Save, Compile, Run (ctrl-enter)

def min_purchases_required(n, p):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy