Browse Source

added first examples of chapter 06: tuples

master
T. Meissner 10 years ago
parent
commit
9588711a2d
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      python_3_oop/chapter06/tuples.py

+ 14
- 0
python_3_oop/chapter06/tuples.py View File

@ -0,0 +1,14 @@
import datetime
def middle(stock, date):
symbol, current, high, low = stock
return ((high + low) / 2), date
tuple = ("GOOG", 613.30, 625.86, 610.50)
mid_value, date = middle(tuple, datetime.datetime.now())
print("middle value: {} at date {}".format(mid_value, date))
print("high value: {}".format(tuple[2]))
print(tuple[1:3])

Loading…
Cancel
Save