From 20f723cae01ad0998249adc9bbf3df76696f8b7f Mon Sep 17 00:00:00 2001 From: asifins1 Date: Thu, 30 May 2024 20:28:29 +0400 Subject: [PATCH] Update wk5 - assignment 5.2.py Fixed indentation Error --- wk5 - assignment 5.2.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) 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)