osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python "Bad syntax"


On Mon, Feb 5, 2018 at 10:13 AM, <darkorbitaknaentou at centrum.cz> wrote:

>
> Hi, I have a problem in continuing the function.
>
> I'm a beginner, I'm learning from a textbook. I'm going to put the
> following examples from a textbook that displays "wrong syntax"
>
>
>> for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
>>>>
>>>             if letter in "AEIOU":
>                 print(letter, "is a vowel")
>            else:
>                  print(letter, "is a consonant")
>
> In this text, I will write a "wrong syntax" after confirming the "else"
> function. How is it possible? Using the Bad Version of Python? Please,
> please, thank you very much!
>
> The same error is in the "break" function:
>
>
>> while True:
>>>>
>>>               item = get_next_item()
>               if not item:
>                    break
>               process_item(item)
>
> Here 'wrong syntax' occurs after the "break".
>
> How is it possible? Bad version of Python? Which version to use?
>
> Thank you for any advice and help!
>
>
> Check that the code is properly indented. I did a cut/paste and then
manually indented the first example and it works fine.


-- 

**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW:   http://www.mellowood.ca