### Thread: Getting the smallest value

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
May 2013
Posts
14
Rep Power
0

#### Getting the smallest value

Hi,

I'm trying to figure out how to display the smallest number from a set of numbers that user inputs in.. Can anyone help point out what I'm doing wrong in my code?

Code:

I apologize if it's not indented properly, it's hard to do it on the forum..

Anyways, as it is: if I input numbers: 55, -13, 24 -> it will give me 24 as the smallest number.

If I remove the first "smallest = input;" it gives my -13 -> which is right BUT the logic is wrong.. It's saying since smallest = 0 is smaller than 55 it won't assign smallest to be equal to whatever input is (in this case 55).

I need it to assign input to the first number (e.g 55) and then compare that to the rest of the numbers...

----

Now, if I try the excepts, I just get a bunch of errors..
Last edited by spabvu90; August 8th, 2013 at 12:52 AM. Reason: Solved
2. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
May 2013
Location
/dev/null
Posts
168
Rep Power
22
Originally Posted by spabvu90
Hi,

I'm trying to figure out how to display the smallest number from a set of numbers that user inputs in.. Can anyone help point out what I'm doing wrong in my code?

Code:

I apologize if it's not indented properly, it's hard to do it on the forum..

Anyways, as it is: if I input numbers: 55, -13, 24 -> it will give me 24 as the smallest number.

If I remove the first "smallest = input;" it gives my -13 -> which is right BUT the logic is wrong.. It's saying since smallest = 0 is smaller than 55 it won't assign smallest to be equal to whatever input is (in this case 55).

I need it to assign input to the first number (e.g 55) and then compare that to the rest of the numbers...

----

Now, if I try the excepts, I just get a bunch of errors..
Hello.. code, code.. where are you?
3. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
May 2013
Posts
14
Rep Power
0
Originally Posted by noobie1000
Hello.. code, code.. where are you?
Oh that's because I already solved it. If you looked at the edit revision note at the end of the post..