Everytime you run a python command, python does does the following steps in sequence:
AnnouncementYou can find all my latest posts on medium.
- Print – if anything needs printing.
- Loopback – go back to the command line
The above is called “repl” for short.
To print anything, you need to use the “print”, which in Python 3, is a function.
=>=>=> print("hello world!")
Some maths are also really easy to do:
=>=>=> 5 # this is a comment.
=>=>=> 2 + 5
=>=>=> x = 20
=>=>=> x*5 # note you can leave out white spaces.
=>=>=> _ – 1 # "_" is a builtin variable that holds the last thing that has been outputted.
Note: The “_” only works on the command line, but not in scripts.
With the maths you can see repl in action.