Skip to content

Create calculate_resistence_in_parallel.py#7838

Closed
0shuvo0 wants to merge 6 commits intoTheAlgorithms:masterfrom
0shuvo0:patch-2
Closed

Create calculate_resistence_in_parallel.py#7838
0shuvo0 wants to merge 6 commits intoTheAlgorithms:masterfrom
0shuvo0:patch-2

Conversation

@0shuvo0
Copy link
Copy Markdown

@0shuvo0 0shuvo0 commented Oct 29, 2022

Describe your change:

Add an algorithm to calculate the total resistance of resistors used in parallel

[x] Add an algorithm

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 29, 2022
@cclauss cclauss added the ON HOLD: Final hours of Hacktoberfest We will review this PR after Hacktoberfest has ended label Oct 29, 2022
total = 0
for val in resistors_in_parallel:
total = total + (1 / val)
return round(1 / total, 2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return round(1 / total, 2)
return 1 / total

No point rounding the output

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't round it we will get crazy result like 85.66694283347141

0shuvo0 and others added 3 commits October 30, 2022 09:56
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 30, 2022
…y we calculate Rt/1

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
@CaedenPH
Copy link
Copy Markdown
Contributor

@cclauss #6782 implemented this

@cclauss cclauss closed this Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed ON HOLD: Final hours of Hacktoberfest We will review this PR after Hacktoberfest has ended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants