0
How to stop user from giving 0 as input in following code
Made a simple program to get roots of equations https://code.sololearn.com/cRbd8q7qWe4w/?ref=app
5 Réponses
+ 1
while True:
try:
value= int(input())
if value == 0:
raise
return value
break
except:
print(" try again ")
+ 1
Then change to
if value <= 0:
+ 1
ChaoticDawg yeah i got it thanxx mate
0
Use if statement ....
If user_input>0:
Your code
else:
print('Give input number greater then 0')
0
ChaoticDawg it worked
Mursalatul Pallob i want user to keep giving input Unless its positive and more than 0