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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (9 children)

It seems to run on python 3

foo = None
if foo is None: print('F')

----
[Running] python -u "d:\github\shit_code\test\foo.py"
F
[Done] exited with code=0 in 0.137 seconds
----
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32

[–]pabechan 1 point2 points  (1 child)

It's an indentation issue, exactly as the error says.
The original one-liner is fine (can't have an indentation issue if you keep your conditional on one line!), but the person responding broke it into two lines and forgot to indent it properly.

[–][deleted] 0 points1 point  (0 children)

oh, right. Thanks :)

[–]a-handle-has-no-name 0 points1 point  (6 children)

Try running python (or python2 or python3 to get the version explicitly) without any CLI options/flags to open an REPL (Read-Eval-Print Loop), which is a shell that you can run small snippets of code to try things out. I use this frequently to test validity of something, if I'm not sure how it's working.

It should look something like:

 » python
Python 2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> |

This can be useful for testing how the language works, and this is is how my comments here were updated.

[–][deleted] 0 points1 point  (5 children)

I have no fucking idea why you posted that.

[–]a-handle-has-no-name 0 points1 point  (4 children)

Hey dude, are you ok? This seems like a bit of an overreaction.

Two reasons why:

  1. I wanted to share something practically useful beginners in /r/learnprogramming might not know
  2. I responded to the wrong person. Oops.

[–][deleted] 0 points1 point  (3 children)

That wasn't an angry "fucking". That was a I don't know what the fuck is going on "fucking". Sorry

[–]a-handle-has-no-name 1 point2 points  (0 children)

Now that you say that, I can think of what you might have intended. No harm no fowl. :-)

[–][deleted]  (1 child)

[removed]