Я пишу программу, которая должна добавлять все положительные значения, которые вводит пользователь, и программа должна зацикливаться до тех пор, пока он не введет отрицательное число. Программа плавно плавно, но включает отрицательное число в сумме. Любая помощь приветствуется!Создание исключения в Python
def main():
X=0
Y=0
print("I can add the sum of all positive numbers")
X = int (input ("Please enter a positve number between 0 and infinity: "))
if X > 0:
while Y >= 0:
print("I can add the sum of all positive numbers")
Y = int(input("Please enter a positive number between 0 and infinity: "))
X = X + Y
print("The sum of the numbers you entered is: ", X)
else:
print("Sorry I can only add positive numbers")
main()