【发布时间】:2022-11-27 23:56:16
【问题描述】:
我有一个歌曲列表:
my_favorite_songs = [
['Waste a Moment', 3.03],
['New Salvation', 4.02],
['Staying\' Alive', 3.40],
['Out of Touch', 3.03],
['A Sorta Fairytale', 5.28],
['Easy', 4.15],
['Beautiful Day', 4.04],
['Nowhere to Run', 2.58],
['In This World', 4.02],
我的任务是找出 3 首随机歌曲的总和? 你能帮我吗?
我试过这个 res = sum(random.choices(time, k=3)),但有一个错误。
【问题讨论】:
-
您随机选择的这个
time是什么?另外 - 不要只是告诉我们您有错误,请告诉我们什么错误是。
标签: python