jeudi 17 octobre 2019

Python project, need some assistance with homework

I need help with some code for an assignment, I am not very good with Python, so I need some help, I have written some code that seemed pretty sound but kept pulling up the something wrong with your files error. Please help me

I have already tries some code that I thought would be good but didn't turn up good at all. It showed no errors in Visual Studio but every time I tried to run it it said "there are some files with errors, do you still want to run your code?" and then it says "no compatible code".

Here are the assignment instructions: Please create a small program to pick three words from the attached array and display the three words to the user in the form of a sentence. One word should be chosen from array one, one word should be chosen form array two, one word should be chosen from array three and then displayed these choices to the user in the form of a sentence. “Your momma is a brave tiger bake .” This insult is a pretty strange one. Come up with another subject to put in front of the three words the system has chosen if you don’t like ‘your momma’ jokes. If you want to ask the user to choose a number and use that number to pick the words that would be fine. If you want to use a random function to choose the number that would be fine. The program also needs to ask the user if they want to do it again, or not. The array: Description Words Mammals Action Words Adorable Squirrel Apper Adventurous Dog Feel Accomplished Cat Get Brave Pig Grow Bright Goat Look Composed Sheep Prove Concerned Horse Remain Demanding Bear Smell Flustered Leopard Sound Focused Tiger Stay Gregarious Fox Taste Grim Otter Turn Handsome Meerkat Ask Handy Giraffe Bake Intelligent Monkey Build Joyful Zebra Carry Lanky Rhinoceros Help Lazy Kangaroo Jump Mellow Elephant Play Miserable Seal Read Items being tested: Arrays Looping Print Input or random Syntax

Here is my code that I made:


    import random

    game = True
    YoMamastring = 'Your Mama is a'
    Description_Words = ['Adorable', 'Adventourus', 'Accomplished', 
    'Brave', 'Bright', 'Composed', 'Concerned', 'Demanding', 
    'Flustered', 'Focused', 'Gregarious', 'Grim', 'Handsome', 'Handy', 
    'Intelligent', 'Joyful', 'Lanky', 'Lazy', 'Mellow', 'Miserable'] 
    Mammal_Words = ['Squirrel', 'Dog', 'Cat', 'Pig', 'Goat', 'Sheep', 
    'Horse', 'Bear', 'Leopard', 'Tiger', 'Fox', 'Otter', 'Meerkat', 
    'Giraffe', 'Monkey', 'Zebra', 'Rhinoceros', 'Kangaroo', 'Elephant', 
    'Seal']
    Action_Words = ['Apper', 'Feel', 'Get', 'Grow', 'Look', 'Prove', 
    'Remain', 'Smell', 'Sound', 'Stay', 'Taste', 'Turn', 'Ask', 'Bake', 
    'Build', 'Carry', 'Help', 'Jump', 'Play', 'Read']
    Player_Choice = ("")
    Player_Choice2 = ("")
    Player_Choice3 = ("")
    while game == True:
     if Player_Choice == "Done":
       print(YoMamastring + {} + '' + {} + '' + 
    {}.format(random.choice(Description_Words), 
    random.choice(Mammal_Words), random.choice(Action_Words))
     elif Player_Choice in Description_Words: 
     print("Choose your Words by typing them in as they are shown,No 
    Quotations, if you want a random one, choose any key and press 
    enter. If you want all your variables to be random, type 'Done', No 
    Quotations.")
      print(Description_Words)
      Player_Choice = print('Choose your description word.\n')
      if Player_Choice in Description_Words:
           print(YoMamastring + {} + '' + {} + '' + 
    {}).format(Player_Choice, Player_Choice2, Player_Choice3)
      else:
           Player_Choice = random.choice(Description_Words)
           print(YoMamastring + {} + '' + {} + '' + 
    {}).format(Player_Choice, Player_Choice2, Player_Choice3)
      print(Mammal_Words)
      Player_Choice2 = print('Choose a Mammal Word.\n')
      if Player_Choice2 in Mammal_Words:
          print(YoMamastring + {} + '' + {} + '' + 
    {}.format(Player_Choice, Player_Choice2, Player_Choice3)
      elif Player_Choice2 == random.choice(Mammal_Words)
           (YoMamastring + {} + '' + {} + '' + {}.format(Player_Choice, 
     random.choice(Mammal_Words), Player_Choice3)
       print(Action_Words)
        c = print('Choose an Action Word.\n')
       if c in Action_Words:
          c = Player_choice3
          print(YoMamastring + {} + '' + {} + '' + 
    {}.format(Player_Choice, Player_Choice2, Player_Choice3)
       else:
          c = random.choice(Action_Words)
           print(YoMamastring + {} + '' + {} + '' + 
    {}.format(Player_Choice
    Player_Choice2, random.choice(Action_Words))
          print("Here is your Joke"")

If you can, can you show me the correct things to do and explain it thoroughly for me, I am just starting with Python and need some help. Thank You!




Aucun commentaire:

Enregistrer un commentaire