Я пишу программу для некоторых статистических данных. Я хочу, чтобы результат выглядел как
11: 4
22: 3
33: 1
вместо
11:4, 22:3, 33:1
потому что мне трудно читать.
Вот код, который у меня есть
#Copy solves here, in seconds, seperated by a comma for each solve
times = [11.9, 14.2, 17.3, 11.2 , 123.4]
#Blank list to copy modified solves into
newtimes = []
for time in times:
#Rounds down every time
time = int(time)
#Adds time to new list
newtimes.append(time)
#Sorts list lowest to highest
newtimes.sort()
#Gets length of new list, which is amount of solves
solves = len(newtimes)
#Set longest and shortest solve times
longestSolve = max(newtimes)
shortestSolve = min(newtimes)
timesfreq = {i:newtimes.count(i) for i in newtimes}
print(newtimes)
print(timesfreq)
print(solves)
print("Your longest solve was " + str(longestSolve) + " seconds and your shortest solve was " + str(shortestSolve) + " seconds")