From 99122b0fef773f02b40236370ba667d6bb6ca875 Mon Sep 17 00:00:00 2001 From: Denis wanjala <61288857+Deniswanja@users.noreply.github.com> Date: Mon, 1 Feb 2021 12:45:37 -0500 Subject: [PATCH] Update common-operations.py --- source/week-2/collections/common-operations.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/week-2/collections/common-operations.py b/source/week-2/collections/common-operations.py index f5e4c9a..2d4aa6d 100644 --- a/source/week-2/collections/common-operations.py +++ b/source/week-2/collections/common-operations.py @@ -1,3 +1,18 @@ +# importing array +from array import array + +# decalare and assign arrays +scores = array('d') + +# adding items to an array +scores.append(97) +scores.append(98) +print(scores) +names = ['Christopher', 'Susan'] +print(len(names)) # Get the number of items +names.insert(0, 'Bill') # Insert before index +print(names) + names = ['Christopher', 'Susan'] print(len(names)) # Get the number of items names.insert(0, 'Bill') # Insert before index