Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def addition_and_subtraction(stringy: str) -> int:
- """
- Return the value of equation.
- The equation only consists of plus (+), minus (-) and digits (0-9).
- There are no 2 consecutive operands. In the end, there is no operand.
- In the beginning, both "+" and "-" are acceptable.
- "1+2" # -> 3
- "-1+21" # -> 20
- "+1-1" # -> 0
- :param stringy: Equation.
- :return: The result of equation.
- """
- def equalizer(unequal: list) -> list:
- """
- Equalize numbers between bigger or smaller numbers.
- [1, 4, 1] # -> [1, 3, 1]
- [1, 2] # -> [1, 2]
- [1, 4, 1, 0, 2] # -> [1, 3, 1, 1, 2]
- :param unequal: Unequalized list.
- :return: Equalized list.
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement