Transistor Current Gain

Program Requirements

A transistor’s current gain is calculated using the formula β = IC / IB, where β (Beta) is the current gain, IC is the collector current, and IB is the base current.

Write a program that prompts for Base and Collector currents, and outputs the current gain. Save as "transistorGain".

Use the provided doctest file to solve this challenge. (

If your code is correct you will get the following output:

TestResults(failed=0, attempted=4)

Example Run

(This example run does not use the doctest code above)

Enter the amount of collector current (in Amperes): 0.1
Enter the amount of base current (in Amperes): 0.001
The transistor current gain is 100.0.

ICS4x Supplemental

Modify the program so it continuously runs until 0 (zero) is entered for the collector current.