I have written below code and tried running in python, it works well if I give input as a =56 b = 67, but it gives wrong comparison if input given as a = 789,b =45566 -
Below is the code written
def max(a,b):
if a>b:
print(a+" is greater than "+b)
else:
print(b +" is greater than "+ a)
o1 = raw_input("Enter value of A ")
o2 = raw_input("Enter value of B ")
to = max(o1,o2)
Output is if A = 789 , B = 45566 is entered - Enter value of A 789 Enter value of B 45566 789 is greater than 45566
Aucun commentaire:
Enregistrer un commentaire