brg...@gmail.com wrote: > On Monday, April 9, 2018 at 3:08:28 AM UTC-4, Peter Otten wrote: >> brg...@gmail.com 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. > > Thanks, Peter, for your quick reply. But here's what happened. When I hit > <return> twice, the cursor did go back to the margin, but skipped two > lines before doing so. Then when I hit <return> after "else:" I got an > error message again. What did I do wrong?
I'm sorry, I did not read your question carefully enough, and missed the "else" part. Please read Terry's correction of my advice. > Also, could you please tell me > how to create a py file. Thanks. Choose "New File" in the "File" menu, then write your code in the window that pops up, save with "Save" (pick a meaningful name that does not collide with any name in Python's standard library) and finally run with "Run Module" in the "Run" menu. -- https://mail.python.org/mailman/listinfo/python-list