If I wanted to add a user-friendly message that says "No mode found"
if the statistics.mode
does not find a mode?
The program is for analyzing statistics.
Here is the code.
import statistics
list = [1, 2, 3]
print(statistics.mode(list))
Edit: This question has been solved. Thanks for the help, everyone. I fixed it by adding:
if len(list)==len(set(list)):
print('No mode found')
My thanks to Kevin Wang for the answer.