String Calculator
π Background Information
There is no background information for this activity.
π― Problem Statement
Write a calculator that takes a list of numbers as a string argument and returns their sum. For example, the argument β1,2,3β would return the number 6 while the argument β4;7;8β would return the number 19.
β Acceptance Criteria
- The calculator should be able to handle zero, one, or many numbers in the string argument.
- If a user passes in an empty string, the calculator should return 0.
- You can assume that the numbers passed into the calculator are all integers.
- The calculator should sum all of the numbers in the string argument.
- I can delimit the numbers in the string argument by commas or semicolons.
- Use assert statements to test your code.
π Dev Notes
In this activity, we will be using a strategy called βping pongβ pair programming. In this setup, two people pair with each other while sharing a computer. Partner A writes an assert statement based on the acceptance criteria outlined above. Then, partner B makes that assert statement pass with the minimal amount of code possible. Afterwards, the partners switch (partner B writes a test and partner A makes it pass). Repeat this process until the password validator function has been implemented.
Think about how you might break this problem down into tiny pieces so that you can solve it effectively!
π₯οΈ Example Output
N/A
π Works Cited
N/A