Re: [Tutor] Concatenating numeric data in Python 3.3

2013-04-24 Thread Rob Day
So, for example, you'd be trying to concatenate the binary data 01010101 and 10101010, and get 0101010110101010? You can do that by shifting the bits: >>> (0b01010101 << 8) + 0b10101010 21930 which is equivalent to: >>> 0b0101010110101010 21930 You can also do it with numerical data: >>> 0b101

Re: [Tutor] nose, git, post-commit hook

2013-02-04 Thread Rob Day
On 4 February 2013 15:32, Albert-Jan Roskam wrote: > I am using git VCS and I read about the possibility to use post-commit hooks > for nose tests. That sounds pretty cool, but does this also have > disadvantages? > It would be very annoying if I couldn't check in code, safely tucked away on >

Re: [Tutor] Error message...

2012-08-23 Thread Rob Day
On 23 August 2012 15:17, Victoria Homsy wrote: > > def isPalindrome(s): > if len(s) <= 1: return True > else: return s(0) == s(-1) and isPalindrome (s[1:-1]) > > I don't see why this wouldn't work... > > Many thanks in advance. > > Kind regards, > > Victoria > Parentheses are used for function

Re: [Tutor] Error in apparently correct code

2012-08-20 Thread Rob Day
Your problem is in this line, as the traceback shows: > return reduce(lambda x,y:x*y, [data[row][i] for i in range(col, col+4)]) > > So the thing you have to think about is - what values can col be? The answer is then in this line: for col in range(len(data[row])) And since each row of your dat