I text talks about a case like the following
if x:
print("Hello")
else:
print("Goodbye")
That's the correct way to format.
Wrong would be:
if x:
print("Hello")
else:
print("Goodbye")
To prevent the wrong way from happening you have to hit the delete key after you wrote print("Hello")
and presed <Enter>
.
What's with the prompt? If you are in IDLE the correct text will look like:
>>> if x:
print("hello")
else:
print("goodbye")
The sentence says that if
would be on the same height if the (>>>
) wouldn't be there. As far as python is concerned if
and else
are on the same level on indention.
No comments:
Post a Comment