I would like an output like this: (I would prefer to use only while and Boolean expressions if possible.)
escribe un numero: -50
debes usar un numero positivo!
escribe un numero: -200
debes usar un numero positivo!
escribe un numero: 200
escribe un segundo numero: -2.5
debes usar un numero positivo!
escribe un segundo numero: 5
escribe un tercer numero: 0
debes usar un numero positivo!
escribe un tercer numero: 200
la suma de tus numeros es x
My code is this:
primer_numero=int(input('escribe un numero?'))
segundo_numero=int(input('escribe un segundo numero'))
tercer_numero=int(input('escribe un tercer numero'))
print('la suma de tus numeros es x')
if primer_numero < 0 or segundo_numero < 0 or tercero_numero < 0:
print('debes usar un numero positivo!!')
The problem with my code is that it asks you the questions and if you put a negative the program continues. I would like you to ask the same question again and warn you to put positive and just continue with the following questions.
all help is welcome and thanks. (edit: change the code to make it easier to understand)