Created
May 24, 2017 13:29
-
-
Save rickyhai11/05cb0233472dd13b54a2a04bc7c0625c to your computer and use it in GitHub Desktop.
array_list created by rickyhai11 - https://repl.it/IOYX/29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import ctypes | |
import timeit | |
class Dynamic_Array(object): | |
def __init__(self): | |
self.n = 0 | |
self.capacity = 10 | |
#self.A = make_new_array() | |
def make_new_array(self, c): | |
''' | |
function to create a new array with n is capacity of new array | |
''' | |
new_array = [] | |
for i in range(c): | |
new_array.append(i) | |
return new_array | |
def shifting_array(self, A, B): | |
A = B | |
return B | |
def print_test(self, xr): | |
for i in range(1, xr): | |
print ('{0} {1} {2}'.format(i, i*i, i*i*i)) | |
class SuperHuman(): | |
a = [] | |
element_count = 0 | |
def __init__(self, name, sex, id): | |
self.name = name | |
self.sex = sex | |
self.id = id | |
def run(self): | |
pass | |
def set_name(self): | |
#a= ['hai', 'thu', 'phong'] | |
for i in range(10): | |
self.a.append(i) | |
# get length of array | |
l = len(self.a) | |
print ('length of array is {}'.format(l)) | |
# get size of array list in bytes | |
b = sys.getsizeof(self.a) | |
print ('Size of array list in bytes: {}'.format(b)) | |
dynamic_array = Dynamic_Array() | |
human = SuperHuman('ricky','female', 1234) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment