-1

I am learning to code with a book called Python Crash Course. I am on the chapter about if statements and the book keeps utilizing >>> to test variables Tue or False (or at least that is what I think). The thing is that I do not know what the symbol means, I thought the book was trying to print a variable, but then I went ahead and type >>> followed by the variable I was trying to test and it did not work.

Here is the example on the book:

>>> car='bmw'
>>> car== 'bmw'
True

How do I get Python to Test that variable to True/False and have the text editor (I am using Geany)show a prompt yielding an answer?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Chris434
  • 21
  • 1
  • probably it is prompt - information in shell or console that now you can write next command. – furas Jul 22 '19 at 21:42
  • 1
    Have you tried running the Python interpreter? Because you'll instantly see it uses `>>>` as the input prompt. BTW, if you haven't - you should! It's free, and working through the book with the interpreter open is likely to be much more informative. – Useless Jul 22 '19 at 21:42
  • `>>>` is conventionally used to indicate the Python prompt (what you get when you run `python` in your shell -- `cmd` on Windows, Terminal on OSX, etc.). Geany sounds like Linux, so you need to be in a terminal at your `bash` prompt, run `python`, and then you can type individual commands and see their results. This is called a REPL. – Linuxios Jul 22 '19 at 21:42
  • They're just using it to differentiate which lines are input code (i.e. the ones with the `>>>` prompt) and which lines are outputs (those without) – Dan Jul 22 '19 at 21:42
  • thanks a lot y'all. I started working with Python IDLE and now I am getting boolean values when I test my conditionals. Dont yet know why I cant do the same thing with the text editor; but IDLE is good enough for now. – Chris434 Jul 28 '19 at 17:41

1 Answers1

4

It's not code but from the Python REPL: https://docs.python.org/3/tutorial/interpreter.html

When commands are read from a tty, the interpreter is said to be in interactive mode. In this mode it prompts for the next command with the primary prompt, usually three greater-than signs (>>>)

When you're using Geany, you're using an editor to write your code into a file and afterwards use the Python interpreter to run that code.

That's different from using Python's "Interactive Mode".

finefoot
  • 9,914
  • 7
  • 59
  • 102