This PR adds a new operation to the calculator program, allowing users to calculate the exponent of two numbers.
Summary
Added a new function named exponent to the calculator.py file. This function takes two arguments, base and exponent, and returns the result of base raised to the power of exponent.
Updated the calculator function to include the new Exponent operation in the list of operations that the user can select.
Added a new print statement to display the option for the Exponent operation.
Updated the option number for the Quit operation to 6.
Added a new elif statement in the calculator function to handle the Exponent operation. This statement calls the exponent function with the user-provided numbers and prints the result.
Updated the if statement that checks if the user wants to quit the calculator to check if the choice is '6' instead of '5'.
Added a test case for the new exponent function to ensure its correctness.
Please review and merge this PR. Thank you!
Fixes #1.
To checkout this PR branch, run the following command in your terminal:
git checkout sweep/add-exponent-operation_2
🎉 Latest improvements to Sweep:
Use Sweep Map to break large issues into smaller sub-issues, perfect for large tasks like "Sweep (map): migrate from React class components to function components"
Getting Sweep to format before committing! Check out Sweep Sandbox Configs to set it up.
We released a demo of our chunker, where you can find the corresponding blog and code.
💡 To get Sweep to edit this pull request, you can:
Leave a comment below to get Sweep to edit the entire PR
Leave a comment in the code will only modify the file
Edit the original issue to get Sweep to recreate the PR from scratch
Description
This PR adds a new operation to the calculator program, allowing users to calculate the exponent of two numbers.
Summary
exponent
to thecalculator.py
file. This function takes two arguments,base
andexponent
, and returns the result ofbase
raised to the power ofexponent
.calculator
function to include the newExponent
operation in the list of operations that the user can select.Exponent
operation.Quit
operation to 6.elif
statement in thecalculator
function to handle theExponent
operation. This statement calls theexponent
function with the user-provided numbers and prints the result.exponent
function to ensure its correctness.Please review and merge this PR. Thank you!
Fixes #1.
To checkout this PR branch, run the following command in your terminal:
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: