GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python3tutorials/examples/05_lists.py at master · aasmpro/python3tutorials Expand file tree/ Copy path05_lists.pyMore file actions 21 lines (19 loc) · 473 Bytes / Copy path05_lists.pyFile metadata and controls21 lines (19 loc) · 473 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # access, update and delete list elements list1 = ['programming', 'python', 1996, 2019, 0.5] print(list1[0]) print(list1[1:4]) list1[2] = 2000 print(list1[2]) del (list1[4]) print(list1) # lists with sub-lists print() persons = [["Abolfazl", 1996], ["Sarah", 1997]] name = persons[0][0] birth = persons[0][1] print("{} was born on {}".format(name, birth)) # list comprehensions print() a = [1, 2, 3] print([x ** 2 for x in a]) print([x + 1 for x in [x ** 2 for x in a]]) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |