0

So I have a program that picks some kind of song according to the genra of music that you put in a field but after i finished the first version of it and I started testing it it whould print 3 to 5 results evry time and it whould be from a random list.It curenlty has 4 list of diffrent kinds of music and its suppose to run through the list that the user had inputed and write the link to a txt file but it gives random results and picks one and writes it.Please help me fix it here is my code :

import os
import random
import time


phonk = ['https://youtu.be/URhQ9iJHIsU?t=0,https://youtu.be/URhQ9iJHIsU?t=136', 'https://youtu.be/URhQ9iJHIsU?t=212', 'https://youtu.be/URhQ9iJHIsU?t=344', 'https://youtu.be/URhQ9iJHIsU?t=465,https://youtu.be/URhQ9iJHIsU?t=581',
         'https://youtu.be/URhQ9iJHIsU?t=752', 'https://youtu.be/URhQ9iJHIsU?t=888', 'https://youtu.be/URhQ9iJHIsU?t=1663', 'https://youtu.be/URhQ9iJHIsU?t=1015', 'https://youtu.be/URhQ9iJHIsU?t=1119', 'https://youtu.be/URhQ9iJHIsU?t=1749']


rap = ['https://youtu.be/bOA_WhT6ff8?t=0', 'https://youtu.be/bOA_WhT6ff8?t=160', 'https://youtu.be/bOA_WhT6ff8?t=380', 'https://youtu.be/bOA_WhT6ff8?t=535', 'https://youtu.be/bOA_WhT6ff8?t=690',
       'https://youtu.be/bOA_WhT6ff8?t=840', 'https://youtu.be/bOA_WhT6ff8?t=1030', 'https://youtu.be/bOA_WhT6ff8?t=1180''https://youtu.be/bOA_WhT6ff8?t=1275', 'https://youtu.be/bOA_WhT6ff8?t=1480']


hiphop = ['https://www.youtube.com/watch?v=tfSS1e3kYeo&ab_channel=TravisScottVEVO', 'https://www.youtube.com/watch?v=ecw1sMKq5ME&ab_channel=MGKVEVO', 'https://www.youtube.com/watch?v=YS8fUmyu320&ab_channel=MurdaBeatzVEVO', 'https://www.youtube.com/watch?v=YS8fUmyu320&ab_channel=MurdaBeatzVEVO', 'https://www.youtube.com/watch?v=oak7VyEHvro&ab_channel=BigSeanVEVO',
          'https://www.youtube.com/watch?v=ELpB_ULQC-E&ab_channel=Smokepurpp-Topic', 'https://www.youtube.com/watch?v=bXcSLI58-h8&ab_channel=LilNasXVEVO', 'https://www.youtube.com/watch?v=leJNDpm_G10&ab_channel=YoungThug', 'https://www.youtube.com/watch?v=R4ITBv0h-kc&ab_channel=DaBabyVEVO', 'https://www.youtube.com/watch?v=yzh6uX9fY0A&ab_channel=JuiceWRLD-Topic']

trap = ['https://www.youtube.com/watch?v=Pw-0pbY9JeU&ab_channel=twentyonepilots', 'https://www.youtube.com/watch?v=f5i7yvgzPUU&ab_channel=TheChainsmokers-Topic', 'https://www.youtube.com/watch?v=OdFldPPptiY&ab_channel=BigBeatRecords', 'https://www.youtube.com/watch?v=UprcpdwuwCg&ab_channel=FueledByRamen', 'https://www.youtube.com/watch?v=7-PP4YpBbmA&ab_channel=AlanWalkerVEVO',
        'https://www.youtube.com/watch?v=VzuNsNwKfZc&ab_channel=TribalTrap', 'https://www.youtube.com/watch?v=Mjbol87vRzs&ab_channel=Jinco-Topic', 'https://www.youtube.com/watch?v=zNvYPVwKuH4&ab_channel=SanHolo-Topic', 'https://www.youtube.com/watch?v=pXRviuL6vMY&ab_channel=FueledByRamen', 'https://www.youtube.com/watch?v=svpmv65Ii60&ab_channel=TrapNation']


print('Welcome to music picker 1.0 :) ')
time.sleep(2)
print('DISCLAIMER! RIGHT NOW WE ONLY HAVE 4 TYPES OF MUSIC.THAT IS RAP,HIPHOP,TRAP AND PHONK(drift phonk) ')
time.sleep(3)
music = input('let as know your type of music: ')

# phonk code
if music == 'phonk' or 'Phonk':
    phonk_selction = random.choice(phonk)
    print(phonk_selction)

    phonk_results = open('results.txt', 'w+')
    phonk_results.write('please do not type in here !' + phonk_selction)
# end

# rap code
if music == 'rap' or 'Rap':
    rap_selection = random.choice(rap)
    print(rap_selection)

    rap_results = open('results.txt', 'w+')
    rap_results.write('please do not type in here !' + rap_selection)
# end

# hiphop code

if music == 'hiphop' or 'Hiphop':
    hiphop_selection = random.choice(hiphop)
    print(hiphop_selection)
    pass

    hiphop_results = open('results.txt', 'w+')
    hiphop_results.write('please do not type in here ! ' + hiphop_selection)
# end

# trap code
if music == 'trap' or 'Trap':
    trap_selection = random.choice(trap)
    print(trap_selection)
    pass

    trap_results = open('results.txt', 'w+')
    trap_results.write('please do not type in here ! ' + trap_selection)
# end

print('please deleat the results file so that you can copy more links :]')
time.sleep(2)
print('press enter to exit')
input()

0 Answers0