dimanche 13 décembre 2020

Python If Statements - Display numeric Results

Need your help. I am writing a python code that returns me the larger of two inputs.

def bigger_num(a, b):
    if a < b:
        print ("First number is smaller than the second number.")
    elif a > b:
        print ("First number is greater than the second number.")
    else:
        print ("Two numbers are equals.")
        
a = input("Enter first number: ")
a = float(a)

b = input("Enter second number : ")
b = float(b)
print(bigger_num(a, b))

Result:
Enter first number: 19
Enter second number : 9
First number is greater than the second number.
None

How do I display the numeric result (a/b) in the print?
Ideal solution example: First number, 19 is greater than the second number

Also, is there a way to remove none from the print result?
Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire