python basis - basic grammar

python program block

  • python program consists of code blocks;
  • Block constituted by the statement;
  • Statement consists of expressions, comments;
  • Sequential statements include statements, conditional statements, loop statements, definition statement;
  • Expression consists variables, operators, constants

 

 

Note

  • Single-line comments begin with #
  • Multi-line comments can have multiple  numbers #, there  '' 'and  "" " 
# This is a comment line 
print ( "hello world!")
 
"" " 
First-line comments
second-line comments
" ""
Print ( "the Hello, Python!")

 

 

indentation

  • used to represent indentation python code blocks, without using braces  {} 
  • Indent number of spaces is variable, but with a block of statements must contain the same number of spaces indented
  • General indentation is four spacebar

 

Guess you like

Origin www.cnblogs.com/wenm1128/p/11549341.html