Fixed Deadspaces

Removed all deadspaces
This commit is contained in:
J-onasJones 2023-09-25 16:29:22 +02:00
parent 6d2ece92ee
commit 1478ec58ad

View file

@ -5,10 +5,10 @@ def convert_time_to_seconds(time_str):
# Convert each part to an integer
minutes = int(time_parts[0])
seconds = int(time_parts[1])
# Calculate the total time in seconds
total_seconds = minutes * 60 + seconds
return total_seconds
@ -19,18 +19,18 @@ with open(input_file, 'r') as file:
for line in file:
line_parts = line.strip().split(':::')
print(line_parts)
# Extract the relevant information
avg_track_length = line_parts[6]
play_count = int(line_parts[3])
if avg_track_length == 'NaN:NaN':
# Use 3 minutes and 30 seconds (3:30) as the default track length
track_length_seconds = convert_time_to_seconds('0:03:30')
else:
# Convert average track length to seconds
track_length_seconds = convert_time_to_seconds(avg_track_length)
# Calculate the product and add it to the total
product = track_length_seconds * play_count
total_product += product