0

I'm new to code and want the smallest number to be outputted and, i'm using (min) to determine that. however (min) only wants to read the first digit. i need it to work with at least double digits below is the code I've used:

c = input("Enter a number: ")
b = input("Enter a number: ")
a = input("Enter a number: ")
d = (min(c, b, a))
print ("Smallest: " + (d))

I really haven't tried that much as i'm new to this and learning through an online class not face to face

  • 1
    `input` always returns a string, and you’re comparing strings lexicographically. See the duplicate above. – deceze Mar 21 '23 at 13:03
  • `input` returns a string value, not a number. So, looks like you need to convert a string to a number. Just read this article https://www.geeksforgeeks.org/python-input-function/ – Vasyl Moskalov Mar 21 '23 at 13:05
  • The issue with your code is that the _input()_ function returns a string, not a number. When you pass the string values to the _min()_ function, it compares them character by character. To fix this, you need to convert the string inputs to integers using _int()_ (or floats) before passing them to the min() function. – JCTL Mar 21 '23 at 13:08

0 Answers0