diff options
author | Ankit Aggarwal <ankitaggarwal011@gmail.com> | 2015-10-11 19:51:43 +0530 |
---|---|---|
committer | Ankit Aggarwal <ankitaggarwal011@gmail.com> | 2015-10-11 19:51:43 +0530 |
commit | 9ee3a687204cbe6caaa11b9fd28470651a70ae2b (patch) | |
tree | 2e81b70f632f8d4a257a9ee6ae81ffdee36d8d68 /python.html.markdown | |
parent | 8592f261996855000d3d2241989ea5563c1bf8ec (diff) |
Added input operations in learn Python 2.7 doc
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/python.html.markdown b/python.html.markdown index 6cfb5dca..95146ca8 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -4,6 +4,7 @@ contributors: - ["Louie Dinh", "http://ldinh.ca"] - ["Amin Bandali", "http://aminbandali.com"] - ["Andre Polykanine", "https://github.com/Oire"] + - ["Ankit Aggarwal", "http://ankitaggarwal.me"] filename: learnpython.py --- @@ -144,6 +145,10 @@ bool("") # => False # Python has a print statement print "I'm Python. Nice to meet you!" +# Simple way to get input data from console +input_string_var = raw_input("Enter some data: ") # Data is stored as a string +input_number_var = input("Enter a number: ") # Data is stored as a number + # No need to declare variables before assigning to them. some_var = 5 # Convention is to use lower_case_with_underscores some_var # => 5 |