Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
544 B
0
Indexable
Never
import random

# List of example songs
songs = [
    "Song 1 - Artist 1",
    "Song 2 - Artist 2",
    "Song 3 - Artist 3",
    "Song 4 - Artist 4",
    "Song 5 - Artist 5",
]

def find_random_song(song_list):
    # Generate a random index within the range of the list
    random_index = random.randint(0, len(song_list) - 1)
    
    # Retrieve the random song
    random_song = song_list[random_index]
    
    return random_song

# Example usage
random_song = find_random_song(songs)
print("Random Song: ", random_song)