Advertisement
pbeens

beens.org Transistor Current Gain Challenge (doctest)

Apr 23rd, 2013
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. def transistor_gain(collector_current, base_current):
  2.     """ (number, number) -> float
  3.  
  4.    Precondition: currents are both postive numbers
  5.  
  6.    Per instructions at http://goo.gl/VuUwy
  7.  
  8.    >>> transistor_gain(1,0.1)
  9.    10.0
  10.    >>> transistor_gain(.1,.3)
  11.    0.3
  12.    >>> transistor_gain(4,3)
  13.    1.3
  14.    >>> transistor_gain(10,10)
  15.    1.0
  16.  
  17.    Write your code for this function below.
  18.    """
  19.     gain = ....
  20.  
  21.     return gain
  22.  
  23. if __name__ == '__main__':
  24.     import doctest
  25.     print (doctest.testmod())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement