Advertisement
UniQuet0p1

Untitled

Oct 9th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def addition_and_subtraction(stringy: str) -> int:
  2. """
  3. Return the value of equation.
  4.  
  5. The equation only consists of plus (+), minus (-) and digits (0-9).
  6. There are no 2 consecutive operands. In the end, there is no operand.
  7. In the beginning, both "+" and "-" are acceptable.
  8.  
  9. "1+2" # -> 3
  10. "-1+21" # -> 20
  11. "+1-1" # -> 0
  12.  
  13. :param stringy: Equation.
  14. :return: The result of equation.
  15. """
  16.  
  17.  
  18.  
  19. def equalizer(unequal: list) -> list:
  20. """
  21. Equalize numbers between bigger or smaller numbers.
  22.  
  23. [1, 4, 1] # -> [1, 3, 1]
  24. [1, 2] # -> [1, 2]
  25. [1, 4, 1, 0, 2] # -> [1, 3, 1, 1, 2]
  26.  
  27. :param unequal: Unequalized list.
  28. :return: Equalized list.
  29. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement