August 7th, 2013, 10:22 PM

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?
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
August 8th, 2013, 01:53 AM

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?
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?
August 16th, 2013, 06:14 PM

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..