Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • What went wrong in my simple code?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 31
    Answer it

    # A very simple python program to compare two numbers using functions 

    from sys import exit
    def main():
        compare(x, y)
    def check():
        # prompt user for two numbers
        x = input("x: ")
        y = input("y: ")
        # apply sanity check
        if x.isnumeric() == False and y.isnumeric() == False:
            print("Usage: only real numbers are accepted.")
            return x, y
    def compare(x, y):
        # TODO
        if x < y:
            return print("x is smaller than y")
        elif x > y:
            return print("x is greater than y")
            return print("They are the same!")


 0 Answer(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: