|
setup diary |
python | ruby |
l=['0','1','2'] | a=['0','1','2'] or %w(1 2 3) |
l[1] | a[1] |
l[1:2] | a[1...2] or a.slice(1...2) |
len(l) | a.size or a.length |
l.append('3') | a.push('3') or a<<'3' |
l.pop() | a.pop |
l.extend(['3','4']) | a.concat(['3','4']) |
l.sort() | a.sort! |
l.index('2') | a.index('2') |
l.reverse() | a.reverse! |
del(l[1]) | a.delete_at(1) |
del(l[1:2]) | a.slice!(1..2) |
l.insert(1,'0.5') | a.insert(1,'0.5') |
l.remove('1') | a.delete('1') |
'3' in l | a.include?('3') |