Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 1.42 KB

recipe_estimate_reding_time_0301.md

File metadata and controls

51 lines (32 loc) · 1.42 KB
  1. Describe the Problem

As a user So that I can manage my time I want to see an estimate of reading time for a text, assuming that I can read 200 words a minute.

  1. Design the Function Signature Include the name of the function, its parameters, return value, and side effects.

def reading_time(text):

'The estimated reading time is: ' -->
  1. Create Examples as Tests Make a list of examples of what the function will take and return. -->

EXAMPLE

Give a text and return esimated reading time

reading_time('text') -> 'The estimated reading time is 1 minute' reading_time('...200...) -> 1.0 reading_time('...400...) -> 2.0 reading_time('...300...) -> 1.5 reading_time('') -> Raises an error 'Empty text'

  1. Implement the Behaviour After each test you write, follow the test-driving process of red, green, refactor to implement the behaviour.

Here's an example for you to start with:

EXAMPLE

from lib.reading_time import *

def test_reading_time_returns_one(): result = reading_time(text) assert result == 'The estimated reading time is 1 minute'

def test_reading_time_returns_twentytwo(): result = reading_time(text) assert result == 'The estimated reading time is 22 minutes'