User Tools

Site Tools


python:features

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python:features [2016/07/13 22:07] mithatpython:features [2017/12/06 01:54] (current) – [if, if/else] mithat
Line 1: Line 1:
 ====== Some Python features ====== ====== Some Python features ======
  
-Header, suite/block, clause:+===== Types ===== 
 +==== Boolean ==== 
 +<code python> 
 +True 
 +False 
 +</code>
  
 +===== Header, suite/block, clause =====
 <code python> <code python>
 if foo == bar:         # header             clause 1 if foo == bar:         # header             clause 1
Line 10: Line 16:
 </code> </code>
  
-if, else, ifelse:+===== Selection ===== 
 +==== if, if/else ==== 
 + 
 +<code python> 
 +if condition: 
 +    suite 
 +</code> 
 + 
 +<code python> 
 +if condition: 
 +    suite 
 +else: 
 +    suite 
 +</code> 
 + 
 +=== nested if/else ===
  
 <code python> <code python>
Line 35: Line 56:
     print('something else')     print('something else')
 </code> </code>
 +
 +===== Iteration/repetition =====
 +<code python>
 +while condition:
 +    suite:
 +</code>
 +
 +**definite loop**: counter controlled repetition, "a program loop in which the number of times the loop will iterate can be determined before the loop is executed."
 +
 +**indefinite loop**: sentinel controlled repetition, "a program loop in which the number of times the loop will iterate is not known before the loop is executed."
 +
 +**flag/semaphore/sentinel**: TODO.
python/features.1468447647.txt.gz · Last modified: 2016/07/13 22:07 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki