Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
d = (b2 ** 2) - (4 * a * c)

# find two solutions
sol1 = (-b2 - cmath.sqrt(d)) / (2 * a)
sol2 = (-b2 + cmath.sqrt(d)) / (2 * a)
sol1 = (-b2-cmath.sqrt(d))/(2*a)
sol2 = (-b2+cmath.sqrt(d))/(2*a)
sol23 = (-b2+cmath.sqrt(d))/(2*a)

Comment on lines 17 to 23
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The roots use -b/+b, but only b2 is defined—this will raise a NameError. Should both the discriminant and roots use b2 consistently?

Suggested change
d = (b2 ** 2) - (4 * a * c)
# find two solutions
sol1 = (-b2 - cmath.sqrt(d)) / (2 * a)
sol2 = (-b2 + cmath.sqrt(d)) / (2 * a)
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a)
sol23 = (-b+cmath.sqrt(d))/(2*a)
d = (b2 ** 2) - (4 * a * c)
# find two solutions
sol1 = (-b2-cmath.sqrt(d))/(2*a)
sol2 = (-b2+cmath.sqrt(d))/(2*a)

Finding types: Logical Bugs Basic Security Patterns

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commit b696d76 addressed this comment. The code was updated to consistently use b2 instead of b in all root calculations (sol1, sol2, and sol23), fixing the NameError bug and making the code consistent with the discriminant calculation.

print('The solution are {0} and {1}'.format(sol1, sol2))

Expand Down
2 changes: 2 additions & 0 deletions typescript/nestjs/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Grabbed from:
https://github.com/nestjs/nest/tree/master/sample/01-cats-app

some commit data