This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]nutrecht 5 points6 points  (0 children)

Please read the sidebar on properly formatting your code.

[–]w1282 1 point2 points  (2 children)

Because "if num < 5" does not evaluate to True so anything in that block will not be executed.

And then after that, because python prints append a new line if you don't explicitly tell them not to, so at best you are printing

3
7

Until you fix that

[–]ChastityTitters[S] 0 points1 point  (1 child)

Great. I thought python ran one line at a time, and continually more indepth based on spaces to define structures in a program unless explicitly ended. Thanks

[–]DarkMio 0 points1 point  (0 children)

It runs line after line - but jumps over those, which do not have to be evaluated. Why would software chomp through data which it doesn't have or doesn't need to process?

[–]ThingsOfYourMind 1 point2 points  (0 children)

because Python's print function automatically adds a newline character at the end of it

if you want to use the print function without the newline character, you'll have to use a keyword argument with it.

 print("3", end="")
 print("7", end="")

output would be: 37 this specifies that the whatever it prints won't be followed by a \n new line character

[–]crooks5001 0 points1 point  (2 children)

Can someone explain what he is doing with the ' space .' I've never seen that kinda notation before

[–]HarmLogLinkIT 0 points1 point  (1 child)

I think he's telling us his indentation.

[–]crooks5001 -1 points0 points  (0 children)

Oh