[Tutor] SYNTAX ERROR MESSAGE

Cameron Simpson cs at cskk.id.au
Fri Jul 23 19:10:15 EDT 2021


On 23Jul2021 03:19, Chukwuemeka Ohakwe <basictech21 at yahoo.com> wrote:
>From  random import randintdef pick(words):    num_words = len(words)    num_picked = randint(0, num_words - 1)    word_picked = words[num_picked]    return word_pickedprint(pick(name), pick(verb), 'a', pick(noun), end='.\n')
>
>Good day friends!please why does this program send error message when I run it?
>The error is highlighted at r in random. It reads: Syntax Error        
>                                                                    
> Invalid Syntax 

That is hard to say because your code is all formatted on one line and 
you have not recited the complete error message. Please include your 
code between triple backticks (the ` character), like this:

    ```
    code here
    etc etc
    ```

but hard against the left hand edge. Do the same with the error message, 
including all of it.

If what you included above is accurate, it may be because you have 
"From".  Python is case sensitive, and "from" needs to be all lower 
case.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Tutor mailing list