Jun-11-2021, 09:46 PM
The problem is that when I choose / and input 5 and 0 (2nd number as 0) it is giving 0.0 but not printing the divisior is zero
#!/usr/bin/python3 num=input("please select operator +,-,*,/ or q to quit") while num != 'q': numlist=input("please enter at least 2 numbers ").split() numlist=[float(i) for i in numlist] total = numlist[0] del numlist[0] if num == '+': for i in numlist: total = i + total print (total) elif num == '-': for i in numlist: total = i - total print (total) elif num == '*': for i in numlist: total = i * total print (total) elif num =='/': if i in numlist ==0: print ("divisior is zero") else: for i in numlist: total = i / total print (total) num=input("please select operator +,-,*,/ or q to quit")