python-for-everybody icon indicating copy to clipboard operation
python-for-everybody copied to clipboard

issue in break

Open sagunraul opened this issue 5 years ago • 3 comments

I am getting issue in break in line no.5 please help me

largest = None smallest = None while True: num = raw_input("Enter a number: ") if num == "done" :break

try: num = int(num) except: print ("Invalid input") continue

if largest is None: largest = num elif largest < num: largest = num

if smallest is None: smallest = num elif smallest > num: smallest = num

print ("Maximum is", largest) print ("Minimum is", smallest)

sagunraul avatar Apr 01 '20 04:04 sagunraul

Hi @sagunraul,

Can you paste your code using Insert Code option so that it becomes easy to tell what's wrong Also, mention what's your error

Regards, Zeke

ZekeLandon avatar Apr 05 '20 09:04 ZekeLandon

Hi @sagunraul I have got the problem so can you please tell me how can I tell That to you??

SHIVANI0708 avatar Oct 06 '20 13:10 SHIVANI0708

Hi @sagunraul I have got the problem so can you please tell me how can I tell That to you??

largest = None smallest = None

while True: num_input = input("Enter a number: ") if num_input == "done": break try: num = int(num_input) if largest is None or num > largest: largest = num if smallest is None or num < smallest: smallest = num except ValueError: print("Invalid input")

if largest is not None and smallest is not None: print("Maximum is", largest) print("Minimum is", smallest)

muduliratikant avatar Apr 21 '23 10:04 muduliratikant