User Tools

Site Tools


python:features

This is an old revision of the document!


Some Python features

Header, suite/block, clause:

if foo == bar:         # header             clause 1
    print('same')          # suite/block    clause 1
else:                  # header             clause 2
    print('different')     # suite/block    clause 2

if, else, ifelse:

if credits == 90:
    print('Senior')
else
    if credits == 60:
        print('Junior')
    else:
        if credits >= 40:
            print('Sophomore')
        else:
            print('something else')
if credits >= 90:
    print('Senior')
elif credits >= 60:
    print('Junior')
elif credits >= 40:
    print('Sophomore')
else:
    print('something else')
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