Skip to content

Create calculate_resistence_in_parallel.py #7838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

0shuvo0
Copy link

@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
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
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

@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 <[email protected]>
@CaedenPH
Copy link
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