columns = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
nColumns = len(columns)
myColumn = columns[6]
>>> columns = "abcdefgh"
אבל אפשר להשיג את אותן תוצאות בצורה יותר פשוטה:
columns = "abcdefgh"
nColumns = len(columns)
myColumn = columns[6]
age
הוא מספר נתון.
במקום:
teenage = 10 < age < 20
if teenage == True:
sys.stdout.write("Beware: a teenager - [s]he knows better\n")
עדיף להשתמש ישירות בערך האמת או השקר כך:
teenage = 10 < age < 20
if teenage:
sys.stdout.write("Beware: a teenager - [s]he knows better\n")
application1, application2