p287ex3 - MinFind the minimum in a list of real numbers.
InputThe first line contains an integer N (1 ≤ N ≤ 10 000). Each of the following N lines contains one real number xi (-1000 < xi < 1000).
OutputThe minimum of the N real numbers given, rounded to two decimal places.
2 10.1 12.3
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 26, 2008
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Your program handles negative numbers weirdly. I searched around a bit, and by casting input() to float, it seemed to work more correctly, though it still received RTE on ideone.
even when i use the str(round()) method it still doesnt work, saying (line 8, type str does not define _round_.
wait, what do you mean by "by casting input() to float, it seemed to work"?
1. input() returns a string.
2. float(input()) casts said string to a float (aka a double or a real).
3. int(input()) casts said string to an integer.
Since N is an integer, clearly after reading it in, you should treat it as an integer.
As for the N real numbers, well, they're reals, so you should be casting them to floats.
PS: To reply to a comment, don't just type it into the bottom. Click the + sign in the top-right corner.