Python -> (2) the most basic: Process Control

Create and execute Python files

create

  • Create the command line: eg, open / .py a new file (input terminal the gedit. gedit tset.py);
  • Created directly in the editor;

carried out

  • Input terminalpython3 test.py

Process Control

Conditional

  • if
  • elif
  • else
  • Note colon end of the line
  • Note 4 indent the next line

cycle

  • the for loop (previously known cycles);for item in iterable:
  • range () function: 1) range (x) can generate a sequence of integers from 0 to x-1's; 2) range (a, b) no header trailer, to generate a sequence of integers from a to b-1;
  • while loop (the number of previously unknown)
  • break (stop cycle)
  • continue (skip this wheel cycle)
Published 33 original articles · won praise 1 · views 1256

Guess you like

Origin blog.csdn.net/weixin_44783002/article/details/104477881