geekcomputers / geekcomputers/Python

Term with mixed case NOT Captured

Open
#334 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
35.4k
Forks
12.9k
Avg merge
2h 37m
Merged PRs (30d)
1

Description

https://github.com/geekcomputers/Python/blob/28b25d4b2a0c484b8e905fd54ec5ffeecf6460c8/calculator.py#L44-L50

If you have term = "Sin(20) + cOs(30)", term.replace(function, withmath) on LINE 50 above would not work except the whole term has been converted to lower case. Hence input validation is required.

Possible Solution:
Add term = term.lower() prior to the loop on LINE 47. Hence, this will remove the need for having .lower() on LINE 48's conditional statement.

@jwadel @Victory-Uchenna

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with calculator.py around lines 44-50, especially the term-processing loop and the replacement condition. Run the calculator with mixed-case function names such as Sin(20) + cOs(30), and confirm that the input is normalized before replacement and produces the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.