# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + id="lpjHS9V1JnH-" executionInfo={"status": "ok", "timestamp": 1634020046796, "user_tz": -420, "elapsed": 688, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
import sys


# + id="BxndooaOvIrb" executionInfo={"status": "ok", "timestamp": 1634020047359, "user_tz": -420, "elapsed": 9, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
class M(object):
  
  def public(self):
    print("Use tab to see mee!")
  
  def _private(self):
    print("You won't be able to tab to see me!")


# + id="XnilgpGmwmbo" executionInfo={"status": "ok", "timestamp": 1634020048102, "user_tz": -420, "elapsed": 3, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
m = M()

# + colab={"base_uri": "https://localhost:8080/"} id="50wDI6XUwnm3" executionInfo={"status": "ok", "timestamp": 1634020048529, "user_tz": -420, "elapsed": 7, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="8ac8e893-df46-49b5-f52b-c66a89bb9776"
m.public()

# + colab={"base_uri": "https://localhost:8080/"} id="jpI4COahwvLs" executionInfo={"status": "ok", "timestamp": 1634020050460, "user_tz": -420, "elapsed": 492, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="5e9ae153-e907-4761-8bd6-1df88b78cd2b"
m._private()

# + id="OWKZAEkhwzCH" executionInfo={"status": "ok", "timestamp": 1634020052235, "user_tz": -420, "elapsed": 311, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
import ctypes

class DynamicArray(object):
  def __init__(self):
    self.n = 0
    self.capacity = 1
    self.A = self.make_array(self.capacity)
  
  def __len__(self):
    return self.n
  
  def __get_item__(self, k):
    if not 0 <= k < self.n:
      return IndexError('K is out of range!')
    
    return self.A[k]
  
  def append(self, element):
    if self.n == self.capacity:
      self._resize(2 * self.capacity) # 2x if capacity isn't enough
    
    self.A[self.n] = element
    self.n += 1
  
  def _resize(self, new_capacity):
    B = self.make_array(new_capacity)
    for k in range(self.n):
      B[k] = self.A[k]
    self.A = B
    self.capacity = new_capacity

  def make_array(self, new_capacity):
    return (new_capacity * ctypes.py_object)()


# + id="r31UaqWqzGHn" executionInfo={"status": "ok", "timestamp": 1634020054606, "user_tz": -420, "elapsed": 532, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
arr = DynamicArray()

# + id="ddiqlkouzI3h" executionInfo={"status": "ok", "timestamp": 1634020055195, "user_tz": -420, "elapsed": 3, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
arr.append(1)

# + colab={"base_uri": "https://localhost:8080/"} id="Q_SRvGH7ICT5" executionInfo={"status": "ok", "timestamp": 1634020055795, "user_tz": -420, "elapsed": 6, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="9095655d-2d04-4232-a7b1-79762c0dca24"
arr.__len__()

# + colab={"base_uri": "https://localhost:8080/"} id="WFHY7TY-IDI8" executionInfo={"status": "ok", "timestamp": 1634020056780, "user_tz": -420, "elapsed": 7, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="46065110-5057-41a2-ef02-8fded4083cc8"
len(arr)

# + colab={"base_uri": "https://localhost:8080/"} id="4VQuBj-2JjHX" executionInfo={"status": "ok", "timestamp": 1634020058142, "user_tz": -420, "elapsed": 4, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="697fa562-a6ee-4888-d141-c0f3546e2c41"
sys.getsizeof(arr)

# + id="vaanh9vzILzh" executionInfo={"status": "ok", "timestamp": 1634020058721, "user_tz": -420, "elapsed": 2, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
arr.append(3)

# + colab={"base_uri": "https://localhost:8080/"} id="TWZpC4hVINys" executionInfo={"status": "ok", "timestamp": 1634020059600, "user_tz": -420, "elapsed": 8, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="1908b5f2-97cd-4ddf-e8cf-604214c930a6"
arr.__len__()

# + colab={"base_uri": "https://localhost:8080/"} id="FzJDYeJYIPqX" executionInfo={"status": "ok", "timestamp": 1634020060111, "user_tz": -420, "elapsed": 7, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="c57ff479-73bb-4019-e38c-34165ad49c68"
len(arr)

# + colab={"base_uri": "https://localhost:8080/"} id="Ycp2svn7IQmx" executionInfo={"status": "ok", "timestamp": 1634020061617, "user_tz": -420, "elapsed": 4, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="8fcd602d-9bbe-4565-dcbc-f6e2d8943126"
sys.getsizeof(arr)

# + id="4huOKZI2Js_W" executionInfo={"status": "ok", "timestamp": 1634020062082, "user_tz": -420, "elapsed": 2, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
arr.append(2)

# + id="0BMAgVLBJ3fs" executionInfo={"status": "ok", "timestamp": 1634020062762, "user_tz": -420, "elapsed": 2, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(4, 13):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="cBwV-jwGKLNb" executionInfo={"status": "ok", "timestamp": 1634020064050, "user_tz": -420, "elapsed": 4, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="efdf5c2e-af23-4d4b-a98c-d34ca69452f6"
arr.__len__()

# + colab={"base_uri": "https://localhost:8080/"} id="fKTjrli1KU7O" executionInfo={"status": "ok", "timestamp": 1634020064627, "user_tz": -420, "elapsed": 7, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="a9d54882-8449-42ac-bfcb-fc253f1dff37"
len(arr)

# + colab={"base_uri": "https://localhost:8080/"} id="Q-iVBgfPKXQB" executionInfo={"status": "ok", "timestamp": 1634020065628, "user_tz": -420, "elapsed": 6, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="5b9b532c-37d4-4a77-84d8-38e50446e60f"
sys.getsizeof(arr)

# + id="YGZA4rFAKZDR" executionInfo={"status": "ok", "timestamp": 1634020067170, "user_tz": -420, "elapsed": 4, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(13, 200):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="oIIlRPPqKgiV" executionInfo={"status": "ok", "timestamp": 1634020067660, "user_tz": -420, "elapsed": 6, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="f7101ea3-982c-4e28-fc09-1de16dc051c7"
arr.__len__()

# + colab={"base_uri": "https://localhost:8080/"} id="zusupdYZKinw" executionInfo={"status": "ok", "timestamp": 1634020067999, "user_tz": -420, "elapsed": 7, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="64f46fb1-d42d-4016-b6a1-386f1e770cb3"
sys.getsizeof(arr)

# + id="-SYgjetNKki-" executionInfo={"status": "ok", "timestamp": 1634020069090, "user_tz": -420, "elapsed": 3, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(200, 1000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="1IgaC0GuKpzn" executionInfo={"status": "ok", "timestamp": 1634020070091, "user_tz": -420, "elapsed": 8, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="96050c48-e59b-4eee-eb28-4321d1ab3fb6"
sys.getsizeof(arr)

# + id="uhwddUFwKssZ" executionInfo={"status": "ok", "timestamp": 1634020071267, "user_tz": -420, "elapsed": 2, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(1000, 20000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="Z3-nWe-cKyZB" executionInfo={"status": "ok", "timestamp": 1634020071764, "user_tz": -420, "elapsed": 4, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="de18d4ae-5818-4c46-fd3d-1bdcbebae95e"
sys.getsizeof(arr)

# + id="-OcTaF-aKz5F" executionInfo={"status": "ok", "timestamp": 1634020072204, "user_tz": -420, "elapsed": 2, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(20000, 100000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="gbuBMc6MK4VG" executionInfo={"status": "ok", "timestamp": 1634020073688, "user_tz": -420, "elapsed": 5, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="7c2e2d24-7f73-4fc5-a058-391fe2d21423"
sys.getsizeof(arr)

# + colab={"base_uri": "https://localhost:8080/"} id="erVcTFMwLD-S" executionInfo={"status": "ok", "timestamp": 1634020080562, "user_tz": -420, "elapsed": 340, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="b66c6e1d-b93f-47e1-d21d-9b660deeab9f"
arr.__len__()

# + id="mKNnkyQSL_vZ" executionInfo={"status": "ok", "timestamp": 1634020110342, "user_tz": -420, "elapsed": 813, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(100000, 500000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="BeH6nqOCMCfM" executionInfo={"status": "ok", "timestamp": 1634020122955, "user_tz": -420, "elapsed": 412, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="44c72f83-ffb7-4334-8959-99382a70c4db"
sys.getsizeof(arr)

# + id="1GAm9FdZMFtv" executionInfo={"status": "ok", "timestamp": 1634020138523, "user_tz": -420, "elapsed": 1313, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(500000, 1000000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="G48TgWEXMJb0" executionInfo={"status": "ok", "timestamp": 1634020147125, "user_tz": -420, "elapsed": 415, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="1437e340-a4f4-4636-fdee-2be6402c8b74"
sys.getsizeof(arr)

# + id="drpZHBdFMLr0" executionInfo={"status": "ok", "timestamp": 1634020198023, "user_tz": -420, "elapsed": 1967, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(1000000, 2000000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="Zkaks0a-MQfh" executionInfo={"status": "ok", "timestamp": 1634020213069, "user_tz": -420, "elapsed": 410, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="1e2335c7-172b-4d95-b8b3-bb6185b11d59"
sys.getsizeof(arr)

# + id="KppQVudxMbp9" executionInfo={"status": "ok", "timestamp": 1634020240533, "user_tz": -420, "elapsed": 3727, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(2000000, 4000000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="oNWzErI2MhwJ" executionInfo={"status": "ok", "timestamp": 1634020247068, "user_tz": -420, "elapsed": 415, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="bea131dc-a3af-4a7a-f2e6-e7b1eef8e176"
sys.getsizeof(arr)

# + id="zKbV3xxJMkEb" executionInfo={"status": "ok", "timestamp": 1634020269664, "user_tz": -420, "elapsed": 2871, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(4000000, 6000000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="9TL9SSA7MpE4" executionInfo={"status": "ok", "timestamp": 1634020274307, "user_tz": -420, "elapsed": 413, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="12faa251-a43c-4b53-8746-6c924945bb08"
sys.getsizeof(arr)

# + id="XXPHOAfNMqvq" executionInfo={"status": "ok", "timestamp": 1634020289749, "user_tz": -420, "elapsed": 2824, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}}
for i in range(6000000, 8000000):
  arr.append(i)

# + colab={"base_uri": "https://localhost:8080/"} id="Tqu8SIryMt_i" executionInfo={"status": "ok", "timestamp": 1634020293352, "user_tz": -420, "elapsed": 404, "user": {"displayName": "hadi learn", "photoUrl": "https://lh3.googleusercontent.com/a/default-user=s64", "userId": "07681876538566626634"}} outputId="6be881cd-06ff-4e0e-c683-a40dd97125c0"
sys.getsizeof(arr)

# + id="Uv3kD-_MMvdb"


StarcoderdataJupyterScriptsDedupFiltered