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

1st May 2020, 5:37 AM
Fanatic
Fanatic - avatar
5 Respuestas
+ 1
while True: try: value= int(input()) if value == 0: raise return value break except: print(" try again ")
1st May 2020, 5:49 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Then change to if value <= 0:
1st May 2020, 6:01 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg yeah i got it thanxx mate
1st May 2020, 6:02 AM
Fanatic
Fanatic - avatar
0
Use if statement .... If user_input>0: Your code else: print('Give input number greater then 0')
1st May 2020, 5:49 AM
Md. Mursalatul Islam Pallob
Md. Mursalatul Islam Pallob - avatar
0
ChaoticDawg it worked Mursalatul Pallob i want user to keep giving input Unless its positive and more than 0
1st May 2020, 5:59 AM
Fanatic
Fanatic - avatar