mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 07:12:31 +03:00
Merge pull request #1471 from ankitaggarwal011/python27-input-operations-add
[python/en] Added instructions on how to perform input operations
This commit is contained in:
commit
a779d9cfb6
@ -150,6 +150,12 @@ bool("") # => False
|
|||||||
# Python has a print statement
|
# Python has a print statement
|
||||||
print "I'm Python. Nice to meet you!" # => I'm Python. Nice to meet you!
|
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.
|
# 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…
Reference in New Issue
Block a user