Ad
Code
Diff
  • def remainder(x, y):
        if x == 0 or y == 0: return -1
        return x%y
    • def remainder(x, y):
    • if x == 0 or y == 0:
    • return -1
    • rem = x % y
    • return rem
    • if x == 0 or y == 0: return -1
    • return x%y
Code
Diff
  • def calculator(a,b,c):
        if b=='+':
            return a+c
        elif b=='-':
            return a-c
        elif b=='*':
            return a*c
        elif b=='/':
            if c==0:
                raise ZeroDivisionError("Cannot divide by zero!")
            else:
                return a/c
        else:
            print('error')
    • def calculator(a,b,c):
    • if b=='+':
    • print(a+c)
    • return a+c
    • elif b=='-':
    • print(a-c)
    • return a-c
    • elif b=='*':
    • print(a*c)
    • return a*c
    • elif b=='/':
    • print(a/c)
    • if c==0:
    • raise ZeroDivisionError("Cannot divide by zero!")
    • else:
    • return a/c
    • else:
    • print('error')
    • calculator(3,'s',7)
    • print('error')
Code
Diff
  • def exp():
        print("\a", "\a", "\a", "\a", chr(10000), chr(10001), chr(10002), chr(10003), chr(10004), chr(10005), sep="\n")
    • def exp():
    • print("\a")
    • print("\a")
    • print("\a")
    • print("\a")
    • print(chr(10000))
    • print(chr(10001))
    • print(chr(10002))
    • print(chr(10003))
    • print(chr(10004))
    • print(chr(10005))
    • print("\a", "\a", "\a", "\a", chr(10000), chr(10001), chr(10002), chr(10003), chr(10004), chr(10005), sep="\n")