Westonci.ca is the premier destination for reliable answers to your questions, brought to you by a community of experts. Connect with a community of experts ready to provide precise solutions to your questions on our user-friendly Q&A platform. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.
Sagot :
Answer:
nums = []
while True:
in = input()
if in:
nums.append(in)
else:
break
if nums:
avg = sum(nums) / len(nums)
for i in range(len(nums)):
if nums[i] == avg:
print(f"index: {i+1}")
print(nums[i])
else:
print(-1) # if there aren't any values in nums
Explanation:
Assuming that you are coding in Python 3x. The last 'else' statement is an edge case that you might want to consider, I don't know what you want to put there, but I'm just going to leave it as -1.
Visit us again for up-to-date and reliable answers. We're always ready to assist you with your informational needs. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Find reliable answers at Westonci.ca. Visit us again for the latest updates and expert advice.