summaryrefslogtreecommitdiffhomepage
path: root/python.html.markdown
diff options
context:
space:
mode:
authorevuez <helloevuez@gmail.com>2015-10-16 10:42:41 +0200
committerevuez <helloevuez@gmail.com>2015-10-16 10:42:41 +0200
commit85adff2c39e6eae77a915638961f2144ef18b5c9 (patch)
treead87847bd5cca361b2e4582a361c4d4d70948aec /python.html.markdown
parent375f0c18ae9b8d8732c480d0647becf1e82adf3e (diff)
parent25e49b8cf10d3879431eae6ffe8a8e5f88843b8d (diff)
Merge 'master' of github.com:adambard/learnxinyminutes-docs
Diffstat (limited to 'python.html.markdown')
-rw-r--r--python.html.markdown14
1 files changed, 13 insertions, 1 deletions
diff --git a/python.html.markdown b/python.html.markdown
index c66b7642..d29bc3da 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -15,7 +15,13 @@ executable pseudocode.
Feedback would be highly appreciated! You can reach me at [@louiedinh](http://twitter.com/louiedinh) or louiedinh [at] [google's email service]
Note: This article applies to Python 2.7 specifically, but should be applicable
-to Python 2.x. For Python 3.x, take a look at the [Python 3 tutorial](http://learnxinyminutes.com/docs/python3/).
+to Python 2.x. Python 2.7 is reachong end of life and will stop beeign maintained in 2020,
+it is though recommended to start learnign Python with Python 3.
+For Python 3.x, take a look at the [Python 3 tutorial](http://learnxinyminutes.com/docs/python3/).
+
+It is also possible to write Python code which is compatible with Python 2.7 and 3.x at the same time,
+using Python [`__future__` imports](https://docs.python.org/2/library/__future__.html). `__future__` imports
+allow you to write Python 3 code that will run on Python 2, so check out the Python 3 tutorial.
```python
@@ -145,6 +151,12 @@ bool("") # => False
# Python has a print statement
print "I'm Python. Nice to meet you!" # => I'm Python. Nice to meet you!
+# Simple way to get input data from console
+input_string_var = raw_input("Enter some data: ") # Returns the data as a string
+input_var = input("Enter some data: ") # Evaluates the data as python code
+# Warning: Caution is recommended for input() method usage
+# Note: In python 3, input() is deprecated and raw_input() is renamed to input()
+
# No need to declare variables before assigning to them.
some_var = 5 # Convention is to use lower_case_with_underscores
some_var # => 5