diff --git a/wk5 - assignment 5.2.py b/wk5 - assignment 5.2.py index 5037590..ad15159 100644 --- a/wk5 - assignment 5.2.py +++ b/wk5 - assignment 5.2.py @@ -6,27 +6,23 @@ largest = None smallest = None -while True: - num = raw_input("Enter a number: ") -if num == "done" : break +while True: + num = input("Enter a number: ") + if num == "done": + break -try: + try: num = int(num) -except: + except: print("Invalid input") -continue + continue -if largest is None: - largest = num -elif largest < num: + if largest is None or num > largest: largest = num -if smallest is None: + if smallest is None or num < smallest: smallest = num -elif smallest > num: - smallest = num - print("Maximum is", largest) -print("Minimum is", smallest) \ No newline at end of file +print("Minimum is", smallest)