0

What is bug in this code?

l= "none" s="none" while True: n=input("enter the value: ") if n=='done': break try: f=float(n) except: print("invalid input") if l is "none "or n>l: l=n elif s is "none"or n<s: s=n print("Max is",l) print("Min is ",s) """ 7,2,bob,10,4 are given as input and output should be : invalid input Max is 10 Min is 2 """

19th Apr 2020, 4:31 AM
somanadh
4 odpowiedzi
0
Try to write the try and except blocks in else part and modify your code using the conditional statements... You didn't used them correctly I think..try to modify the code by keeping the conditional statements correctly..
19th Apr 2020, 6:27 AM
sarada lakshmi
sarada lakshmi - avatar
0
n is not equals to none if you enter a value of integer
19th Apr 2020, 6:34 AM
1337ca
0
but you write int(input
19th Apr 2020, 6:35 AM
1337ca
0
we cannot change a letter to float
19th Apr 2020, 6:35 AM
1337ca