For Loops in Python (Output Smallest Input)
<p>Okay so I am practicing for loops in  Python and I was wondering how could I make a user input 10 intergers then it would output the smallest one. I would know how to do this with a while loop for example: </p>

<pre><code>Smallest = 0
count = 0
while count &lt; 10:
    Number = int(input("Enter a number &gt;&gt; "))
    if Number &lt; Smallest:
        Smallest = Number
    count = count + 1

print("{0} is the biggest value you have entered".format(Smallest))
</code></pre>

<p>But how do I do it in a for loop format? Here's what I have so far:</p>

<pre><code>for i in range(10):
    Number = int(input("Enter a Number &gt;&gt; "))
    if Number &lt; Smallest:
        Smallest = Number

print("{0} is the smallest value you have entered.".format(Smallest))
</code></pre>

<p>If you want to get the smallest of the input numbers, you need to start with a minimum a bit bigger than 0... and that is a problem you have with your while loop. It will only work if the user inputs at least one negative number, else it will return <code>0</code>.</p>

<p>Here is what I suggest:</p>

<pre><code>smallest = float("inf")
for i in range(10):
    number = int(input("Enter a Number &gt;&gt; "))
    if number &lt; smallest:
        smallest = number
print("{0} is the smallest value you have entered.".format(smallest))
</code></pre>

<p>Note that I did not capitalize the variables, because to me it makes them look like classes. ^^</p>

python loops for-loop