''' class_private101.py
class variables and methods can be made private to the class
'''
class C(object):
'''
inheriting object is automatic in Python3
'''
# k is public to all instances of class C
k = 1234
# variable names with double underline prefix like
# __m or __m_ will be private to the class
# (now Python uses _classname__m here _C__m internally)
__m = 5678
# _n or _n_ or _n__ or __n__ will be public
__n__ = 999
def __init__(self, v):
'''
__init__() will be used first, if it's there
'''
self.value = v
def add(self, x):
return self.value + x
def __subtract(self, y):
'''
double underline prefix makes this method private to class
'''
return self.value - y
def deduct(self, y):
return self.__subtract(y)
a = C(7) # implies C.__init__(a, 7)
print(C) # <class '__main__.C'>
print(a) # <__main__.C object at 0x009FCB50>
print(a.add(2)) # 9
print(a.deduct(4)) # 3
print(a.value) # 7
print(a.k) # 1234
print(a.__n__) # 999
# note that variable __m and
# method __subtract() are private to the class and
# give AttributeError: 'C' object has no attribute '__m'
# or AttributeError: 'C' object has no attribute '__subtract'
#print(a.__m)
#print(a.__subtract(4))

Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...