Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Python-3 Online

import webbrowser
#name input
#input favourite song
favsong=input("What is your favourite song? ")
#print opinion
print("Very good, I also like that song, but it's not my favourite.")
#input yes or no
yn=input("Do you want to listen to some popular songs?")

#url directory
url1 = 'https://www.youtube.com/watch?v=JGwWNGJdvx8'
url2 = 'https://www.youtube.com/watch?v=fyaI4-5849w'
url3 = 'https://www.youtube.com/watch?v=kJQP7kiw5Fk'
url4 = 'https://www.youtube.com/watch?v=7Qp5vcuMIlk'
url5 = 'https://www.youtube.com/watch?v=nfs8NYg7yQM'
url6 = 'https://www.youtube.com/watch?v=qPTfXwPf_HM'
url7 = 'https://www.youtube.com/watch?v=aatr_2MstrI'
url8 = 'https://www.youtube.com/watch?v=vSW2M-BB1NE'
url9 = 'https://www.youtube.com/watch?v=IhP3J0j9JmY'
url10 = 'https://www.youtube.com/watch?v=GsF05B8TFWg'
url11 = 'https://www.youtube.com/watch?v=e2vBLd5Egnk'


#if else
if yn.lower()=="yes":
#print the possible solutions
    print("Shape of you = a \nWild thought = b \nDespacito = c \nCastle on the Hill = d \nAttention = e \nMama = f \nSymphony = g \nStrip that Down = h \nBeliever = i \nMore than you know = j \nScared to be Lonely = k")
#input letter
    songch=input("Choose the song you want to listen to from above. Use letters!") 

#song choice
    if songch=="a":
        webbrowser.get('chrome').open_new (url1)

    elif songch=="b":
        webbrowser.get('chrome').open_new(url2)

    elif songch=="c":
        webbrowser.get('chrome').open_new(url3)

    elif songch=="d":
        webbrowser.get('chrome').open_new(url4)

    elif songch=="e":
        webbrowser.get('chrome').open_new(url5)

    elif songch=="f":
        webbrowser.get('chrome').open_new(url6)

    elif songch=="g":
        webbrowser.get('chrome').open_new(url7)

    elif songch=="h":
        webbrowser.get('chrome').open_new(url8)

    elif songch=="i":
        webbrowser.get('chrome').open_new(url9)

    elif songch=="j":
        webbrowser.get('chrome').open_new(url10)

    elif songch=="k":
        webbrowser.get('chrome').open_new(url11)

    else:
        print("Your request was invalid!")

#goodbye message
else:
    print("Thank you for using our musicbot.")
    
      

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.