Input operation:
Input operation is used for taking input from
command line/prompt that is from user.
username = input(‘Enter user name:’)
print(username)
Comments:
In Python comments are followed by ‘#’ sign.
Reserved words
A keyword is an identifier that has
predefined meaning in a programming language and therefore cannot be used as a
“regular” identifier. Doing so will result in a syntax error.
Indentation
indentation is four spaces.
Don't use tabs, don't mix them with spaces.
Use four spaces, not two, not three, not five. Just use four.
To indicate a
block of code in Python, you must indent each line of
the block by the same amount. The two blocks of code in our example
if-statement are both indented four spaces,
which is a typical amount of indentation for Python
order_total = 247 # GBP
# classic if/else form
if order_total > 100:
discount
= 25 # GBP
else:
discount
= 0 # GBP
print(order_total, discount)
No comments:
Post a Comment