Computer Science, asked by zeeshanasif9999, 5 months ago

Write a program that repeatedly takes integers from the user as long as he wants to input.​

Answers

Answered by Anonymous
2

Explanation:

largest = None

smallest = None

while True:

try:

num = raw_input("Enter a number: ")

if num == 'done':

break;

n = int(num)

largest = num if largest < num or largest == None else largest

smallest = num if smallest > num or smallest == None else smallest

except:

print "Invalid input"

print "Maximum number is ", largest

print "Minimum number is ", smallest

Answered by Aryanhero64
0

Answer:

largest = None

smallest = None

while True:

try:

num = raw_input("Enter a number: ")

if num == "done":

break

#print (num)

num = int(num)

if largest is None or largest < num:

largest = num

elif smallest is None or smallest > num:

smallest = num

except ValueError:

print("Invalid input")

print ("Maximum is", largest)

print ("Minimum is", smallest)

#Enter 7,2,bob,10,4 u will get desired output

Similar questions