Last active
December 11, 2023 22:01
-
-
Save MartinWeiss12/cdf5d615fdae906cf1709ff05629dc9e to your computer and use it in GitHub Desktop.
Most Consecutive Streams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpi = 0 | |
max_count = 0 | |
unique_uri_list = [] | |
for i in range(len(uri_list) - 1): | |
if uri_list[i] == uri_list[i+1]: | |
count = count + 1 | |
if count > max_count: | |
max_count = count | |
mpi = i | |
unique_uri_list.append(uri_list[i]) | |
else: | |
count = 0 | |
start_ts = ts_list[mpi - max_count] | |
track = track_list[mpi] | |
times_played = max_count | |
end_ts = ts_list[mpi] | |
print(f'You played {track} {times_played} times in a row from {start_ts} to {end_ts}.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment