1

I made a simple program to find the larger number. It works great, but it has issues when you start putting two digits into the input.

input_num1 = input("Enter The First Number: ") 
input_num2 = input("Enter The Second Number: ")

list = []

list.append(input_num1)
list.append(input_num2)

if input_num1 == input_num2:
  print ("These numbers are equal")
else:
  print(max(list))

I was wondering if someone could tel me why this is the case.

Etheran
  • 11
  • 1
  • 4
    `input()` returns *strings*. Strings are compared character-by-character, so `10` is less than `2`, for example. Use `int()` to turn your values into actual numbers. – jasonharper Sep 13 '19 at 18:21
  • as @jasonharper said convert input to integer: `int(input("Enter The First Number: "))` – Charif DZ Sep 13 '19 at 18:25

0 Answers0