Skip to content

Create calculate_resistence_in_series.py#7834

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

Create calculate_resistence_in_series.py#7834
0shuvo0 wants to merge 2 commits intoTheAlgorithms:masterfrom
0shuvo0:patch-4

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

@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