+ 2

How to leave a line in python

24th Dec 2018, 12:56 PM
Jacob Heath
Jacob Heath - avatar
2 Antworten
+ 2
print("Who goes there?\n") print("Me") I gave \n for a blank line. Assuming that's what he wanted
24th Dec 2018, 1:48 PM
KKendavar
KKendavar - avatar
+ 3
I'm not sure what "leave a line" means. Technically, you don't even need to end a print statement with '\n' because each print statement will automatically end with a line break. So appending '\n' will lead to a double line break (i.e. a blank line). It looks like in one of your codes, you don't end if statements with a colon (:). They are supposed to look like this: if condition: # note the colon do_something() Is that what you're talking about?
24th Dec 2018, 2:30 PM
Anna
Anna - avatar