Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
846 B
1
Indexable
Never
non_negative_integer = int(input("Enter a non-negative integer: "))

i = 0
count = 0
if non_negative_integer >= 0:
    while non_negative_integer >= 0:
        if non_negative_integer % 2 == 0 and non_negative_integer >= 0:
            count += 1
        non_negative_integer = int(input("Enter a non-negative integer: "))
        if non_negative_integer % 2 == 0 and non_negative_integer >= 0:
            i += non_negative_integer
        if non_negative_integer < 0 and i == 0 and count == 0:
            print(f"The average value of non-negative integers entered: {round(i,2)}")
        elif non_negative_integer < 0:
            i = i / count
            print(f"The average value of non-negative integers entered: {round(i,2)}")
            
else:
     print("No non-negative even values were entered!")
     
     
     
     
     
     
Leave a Comment