Question
Each time Kevin re-reads his Python book (which happens every month), he learns some percentage of whatever material he didn't know before. He has a
Each time Kevin re-reads his Python book (which happens every month), he learns some percentage of whatever material he didn't know before. He has a target score (example: 95%) on the final exam to get an A in the class. When Kevin starts, he knows nothing about Python.
For example: When Kevin knows 20% and his monthly learning rate is 10%, then after one month Kevin will know 20% + 10% * 80% = 28%. In the next month, he will know 28% + 10% * 72% = 35.2%.
Write a generic functiongetLearningTime(rate,target)that simulates this learning progress andreturnsthe number of months it will take to get ready for the exam. Therateis the learning rate (in the example above 20%), and thetargetis the score that is to be achieved (in the example above 95%).
Note:Assume 0% knowledge when you start learning.
Note:rateandtargetare < 1 (i.e. arateof 0.2 means a 20% learning rate)
Example function call:getLearningTime(0.1,0.9)
This is python, thank you!
start the code with def getLearningTime(rate, target):
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started