Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
746 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
            i += non_negative_integer
            non_negative_integer = int(input("Enter a non-negative integer: "))
        elif non_negative_integer % 2 != 0 and non_negative_integer >= 0:
            non_negative_integer = int(input("Enter a non-negative integer: "))
    average = i/count
    print(f"The average value of non-negative integers entered: {round(average,2)}")
else:
     print("No non-negative even values were entered!")
     
     
     
     
     
     
Leave a Comment