Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fix(boolean):
- if boolean == True:
- return 1
- if boolean == False:
- return -1
- def multiple_slow(a,b):
- print(f"{a} * {b} = ", end="")
- accum = 0
- top = max(a,b)
- bot = min(a,b)
- neg = [fix(bot<0), fix(top<0)]
- for _ in range(abs(bot)):
- accum += abs(top)
- print(accum * neg[0] * neg[1])
- multiple_slow(1,1)
- multiple_slow(2,1)
- multiple_slow(3,1)
- multiple_slow(-8,2)
- multiple_slow(-2,-2)
- multiple_slow(-0,-0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement