0% found this document useful (0 votes)
35 views2 pages

ACTIVITY 3 Computer Programing

Python programing

Uploaded by

kier.samonteza03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

ACTIVITY 3 Computer Programing

Python programing

Uploaded by

kier.samonteza03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Republic of the Philippines

BATANGAS STATE UNIVERSITY


The National Engineering University
Alangilan Campus
Golden Country Homes, Alangilan Batangas City, Batangas, Philippines 4200
Tel Nos.: (+63 43) 425-0139 local 2121 / 2221
E-mail Address: coe.alangilan@g.batstate-u.edu.ph | Website Address: http://www.batstate-u.edu.ph

College of Engineering – Department of Civil Engineering

NAME: Samonteza, Kier G. DATE: May 2, 2024


SECTION: CE 1206

ACTIVITY 3: LOOPS

Resistor Manager and Total Resistance Calculator


Instructions:

1. Options:
Your program must present the following options repeatedly:
● Add a resistor: Choose this option to add a resistor to the circuit.
● Calculate total resistance: Choose this option to calculate the total resistance of the
circuit.
● Exit: Choose this option to exit the program.

1. Adding a Resistor:
● Enter the resistance value of the resistor when prompted.
● The program will validate the input to ensure it consists of valid characters ('0' to '9' and
'.').
● If the resistance value is valid and greater than zero, it will be added to the list of
resistors, and a confirmation message will be displayed.
● If the resistance value is not valid or less than or equal to zero, an appropriate error
message will be displayed.

2. Calculating Total Resistance:


● If no resistors have been added yet, the program will display a message indicating that no
resistors have been added.
● If resistors are present:
● The user must be prompted to enter the connection type (series or parallel).
● For Series Connection:
● The program will sum up all the resistance values to calculate the total
resistance.
The total resistance value will be displayed with two decimal places.
● For Parallel Connection:
● The program will calculate the total resistance using the formula:
Total Resistance = 1 / (1/R1 + 1/R2 + 1/R3 + ...) (Reciprocal of the sum
of reciprocals of all resistances)
● It iterates over each resistance value, calculates its reciprocal, and sums
them up.
● Finally, it takes the reciprocal of the sum to obtain the total resistance of
the parallel circuit. The total resistance value will be displayed with two
decimal places.
3. Exiting the Program:
● Choose this option to exit the program gracefully.

Leading Innovations, Transforming Lives, Building the Nation


Republic of the Philippines
BATANGAS STATE UNIVERSITY
The National Engineering University
Alangilan Campus
Golden Country Homes, Alangilan Batangas City, Batangas, Philippines 4200
Tel Nos.: (+63 43) 425-0139 local 2121 / 2221
E-mail Address: ceafa@g.batstate-u.edu.ph | Website Address: http://www.batstate-u.edu.ph

Department of Electrical Engineering

Note:
● Ensure to input valid resistance values (greater than zero) when adding resistors.
● When calculating the total resistance, choose either "series" or "parallel" connection type.
● Any invalid input or choices will prompt you to try again.

Please provide a screenshot of your program. Remember, it's essential to maintain originality when completing this
task.

Leading Innovations, Transforming Lives, Building the Nation

You might also like