mardi 15 décembre 2020

Type Object Is Not Subscriptable

I'm trying to create a program which multiplies user input (streams) by data from the list given at the start of the code. It says that the type object is not subscriptable and and there are incompatible types in the assignment

services =  "'Spotify', 'Apple Music', 'Google Play Music', 'Deezer', 'Pandora', 'Amazon Music Unlimited', 'Tidal'" #variable of the row names
possiblePayment = [0.00318,0.00563,0.00551,0.00436,0.00151,0.01196,0.00989]
possiblePayment = float

streams=input("How many streams would you like to calculate: ") #user input
streams=int
print("The options of streaming services are " + services) #gives user the options of streaming services they can choose from
platform=input("What platform would you like to calculate your streams on: (Case Sensitive! Please type name as it appears above) ") #user chooses service
    
if platform == "Spotify":
    print("Spotify will pay you $" + str(possiblePayment[0]) + " per stream") #if the user chooses Spotify, take data from row 2 (the row with spotify in it) of the file
    print("You would earn $" + str(streams*possiblePayment[0])) #multiplies "streams" by the data in row 2 of the file (DOES NOT WORK, HERE IS WHERE THE ERRORS OCCUR)
            
elif platform == "Apple Music":
    print("Apple Music will pay you $" + str(possiblePayment[1]) + " per stream") #see above
    print("You would earn $" + str(streams*possiblePayment[1])) 
            
elif platform == "Google Play Music":
    print("Google Play Music will pay you $" + str(possiblePayment[2]) + " per stream")
    print("You would earn $" + str(streams*possiblePayment[2]))
            
elif platform == "Deezer":
    print("Deezer will pay you $" + str(possiblePayment[3])+ " per stream")
    print("You would earn $" + str(streams*possiblePayment[3]))
            
elif platform == "Pandora":
    print("Pandora will pay you $" + str(possiblePayment[4]) + " per stream")
    print("You would earn $" + str(streams*possiblePayment[4]))
            
elif platform == "Amazon Music Unlimited":
    print("Amazon Music Unlimited will pay you $" + str(possiblePayment[5]) + " per stream")
    print("You would earn $" + str(streams*possiblePayment[5]))
            
elif platform == "Tidal":
    print("Tidal will pay you $" + str(possiblePayment[6]) + " per stream")
    print("You would earn $" + str(streams*possiblePayment[6]))
            
else:
    print("Invalid Input") #if they dont give the name of a streaming service

Aucun commentaire:

Enregistrer un commentaire