Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def math_operations(*args, **kwargs):
- from collections import deque
- args = deque(args)
- while args:
- kwargs['a'] += args.popleft()
- if args:
- kwargs['s'] -= args.popleft()
- else:
- break
- if args and args[0] != 0:
- kwargs['d'] /= args.popleft()
- elif args:
- args.popleft()
- else:
- break
- if args:
- kwargs['m'] *= args.popleft()
- return kwargs
- print(math_operations(2, 12, 0, -3, 6, -20, -11, a=1, s=7, d=33, m=15))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement