Help Needed : script weird result.
mohan4h at gmail.com
mohan4h at gmail.com
Sat Sep 1 13:11:59 EDT 2018
All,
I m trying to run this small script to find the lowest of the given array of numbers. The script works fine for various combination of inputs but fails in a weird way for a particular set of inputs, can anyone point the mistake in the script and the behavior.
Script
x = input ("Enter the numbers separated by space and press ENTER :")
x = x.split(" ")
def checkmin(arr):
lowest = arr[0]
for count in range(0,len(arr),1):
if arr[count] < lowest :
lowest = arr[count]
else :
pass
print (lowest)
return lowest
minimum = checkmin(x)
print ("Lowest : {0}".format (minimum))
Weird output is as below.
================== RESTART: C:\Users\mohan\Desktop\temp.py ==================
Enter the numbers separated by space and press ENTER :5 90 63 82 59 24
5
5
5
5
5
24
Lowest : 24
Regards
Mohan C
More information about the Python-list
mailing list