Skip to content

Create calculate_resistence_in_series.py #7834

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 2 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 series

[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
Comment on lines +11 to +14
total = 0
for val in resistors_in_series:
total = total + val
return total
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
total = 0
for val in resistors_in_series:
total = total + val
return total
return sum(resistors_in_series)

@@ -0,0 +1,20 @@
resistors_in_series = [100, 150, 330]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a test variable, so it should be inside the doctest

Suggested change
resistors_in_series = [100, 150, 330]

"""
Calculate total resistance of resistors used in series

>>> calculate_resistence_in_series(resistors_in_series)
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
>>> calculate_resistence_in_series(resistors_in_series)
>>> calculate_resistence_in_series([100, 150, 330])

@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