Untitled
unknown
plain_text
7 months ago
780 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 non_negative_integer % 2 == 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!") else: print("No non-negative even values were entered!")
Leave a Comment