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
Python 2.7.5 |Anaconda 1.6.1 (x86_64)| (default, Jun 28 2013, 22:20:13) | |
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> 'abc'[1] | |
'b' | |
>>> 'abc'[1] = 'c' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: 'str' object does not support item assignment | |
>>> array = ['dog', 'cat', 'duck'] |
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
sum0=0; | |
sum1=0; | |
for i=1:m, | |
sum0=sum0+(theta(1)+theta(2)*X(i,2))-y(i); | |
sum1=sum0*X(i,2); | |
end | |
temp0=theta(1)-(alpha/m)*sum0; | |
temp1=theta(2)-(alpha/m)*sum1; |
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
def find_sequence goal | |
def find start, history, goal | |
if start == goal | |
history | |
elsif start > goal | |
nil | |
else | |
find(start + 5, '(' + history + ' + 5)', goal) || find(start * 3, '(' + history + ' * 3)', goal) | |
end | |
end |