lundi 17 mai 2021

Invaild Syntax on random inbuilt funtion [closed]

on the second line they is a syntax error for Top and i dont understand the reason behind it I dont understand why they is an erorr with the element Power Top Girls

import random

nameList = [Power Top Girls,  Machatee, pimp C, Elon Musk, James Brown, Cameron Diaz]

while True:
    indexName = random.randrange(0, 5)  #choose from the the name list

    name = nameList(indexName) #convert for options

    verb = input("pls enter a verb:")

    adjective = input ("pls enter an adjective:")

    noun = input ("pls enter a noun:")

    sentence =  name  + ' '  + verb +  ' ' +  ' through the forest, hoping to escape/
    the' + adjective + ' ' + noun + '.'         

    print()
    print(sentence)
    print()  

    #see if user wants to quit or continue
    answer = input("Type 'q' to quit, or (enter/return) if you want to contine:")
    if answer == "q":
        break 

print ("bye")



Aucun commentaire:

Enregistrer un commentaire