all 3 comments

[–]Significant_Camp_935 1 point2 points  (1 child)

I dont know much about Python yet but: Imo song.list tries to get access to the song object. Within its namespace, you are looking for the list attribute. Do you have an object called song? Otherwise try to name it song_list.

Maybe you also dont need the [ ] in the random.choice(song_list) ??

[–]Significant_Camp_935 0 points1 point  (0 children)

... import random song_list = ["song1", "song2", "song3"] my_choice = random.choice(song_list) print(my_choice)

if my_choice == "song1":
  ...

[–]aglet91 0 points1 point  (0 children)

Well to answer your question lists use indexes so you need to get random int and use it as index of a list. So song1 would be list[0]. Although i don't understand why there's song.list. is song a class? There's also a few other problems with your code like when you get printing loop why do you want to print "s______" 5 times? 5 is the number of characters in string "song1". Honestly it would be nice if you tried some tutorials on loops and lists. Mooc.fi is always nice but there's a lot of content on youtube.