The basics · Lists
Lists
Many values under one name — and two names for one list. · 12 minutes
A list holds values in order: nums = [3, 1, 4]. nums[0] is the first, nums[-1] the last, len(nums) how many. nums.append(5) adds to the end. for n in nums: visits each one.
Predict first
What does this print?
1a = [1, 2, 3]2b = a3b.append(4)4print(a)