[email protected] wrote:
> I typed the If part of an If/Else statement, but did not get a prompt at
> the beginning of the next line when I hit return. Instead, the cursor
> lined up under the "p" of "print." Here is the line of text (it's part of
> a longer bit of coding, I copied out of a textbook).
>
>>>> if right_this_minute in odds:
> print("This minute seems a little odd.") [Return]
>
> You can't see it, but the cursor is blinking under the "p."
>
> Why is this happening and what's the fix?
>
> Thanks,
>
> Tamara
It works as designed; the interpreter has no way of knowing whether you are
about to write another line belonging to the if suite, like in
if foo:
print("clearing foo")
foo = False
That's why you have to hit <return> twice to trigger execution of the code.
By the way, when you copy (or write) a "longer bit" I recomend that you put
the code into a py file so that you don't have to retype it when you want to
make a small modification. Instead you can just hit F5 and see the effect of
your changes.
--
https://mail.python.org/mailman/listinfo/python-list