mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-17 13:38:38 +01:00
Added input operations in learn Python 2.7 doc
This commit is contained in:
parent
8592f26199
commit
9ee3a68720
@ -4,6 +4,7 @@ contributors:
|
|||||||
- ["Louie Dinh", "http://ldinh.ca"]
|
- ["Louie Dinh", "http://ldinh.ca"]
|
||||||
- ["Amin Bandali", "http://aminbandali.com"]
|
- ["Amin Bandali", "http://aminbandali.com"]
|
||||||
- ["Andre Polykanine", "https://github.com/Oire"]
|
- ["Andre Polykanine", "https://github.com/Oire"]
|
||||||
|
- ["Ankit Aggarwal", "http://ankitaggarwal.me"]
|
||||||
filename: learnpython.py
|
filename: learnpython.py
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -144,6 +145,10 @@ bool("") # => False
|
|||||||
# Python has a print statement
|
# Python has a print statement
|
||||||
print "I'm Python. Nice to meet you!"
|
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.
|
# No need to declare variables before assigning to them.
|
||||||
some_var = 5 # Convention is to use lower_case_with_underscores
|
some_var = 5 # Convention is to use lower_case_with_underscores
|
||||||
some_var # => 5
|
some_var # => 5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user