Finding the Min and Max of User Inputs
<p>I'm learning Python, and in trying to find out the min and max values of user number inputs, I can't seem to figure it out.</p>

<pre><code>count = 0
x = []
while(True):
    x = input('Enter a Number: ')
    high = max(x)
    low = min(x)
    if(x.isdigit()):
        count += 1
    else:
        print("Your Highest Number is: " + high)
        print("Your Lowest Number is: " + low)
        break
</code></pre>

<p>break your program into small manageable chunks start with just a simple function to get the number</p>

<pre><code>def input_number(prompt="Enter A Number:"):
    while True:
         try: return int(input(prompt))
         except ValueError:
             if not input: return None #user is done
             else: print("That's not an integer!")
</code></pre>

<p>then write a function to continue getting numbers from the user until they are done entering numbers</p>

<pre><code>def get_minmax_numbers(prompt="Enter A Number: "):
   maxN = None
   minN = None
   tmp = input_number(prompt)
   while tmp is not None: #keep asking until the user enters nothing
        maxN = tmp if maxN is None else max(tmp,maxN)
        minN = tmp if minN is None else min(tmp,minN)
        tmp = input_number(prompt) # get next number
   return minN, maxN
</code></pre>

<p>then just put them together</p>

<pre><code> print("Enter Nothing when you are finished!")
 min_and_max = get_numbers()
 print("You entered Min of {0} and Max of {1}".format(*min_and_max)
</code></pre>

python python-3.x