Re: [Tutor] Modulus Operator ?

2015-11-19 Thread Danny Yoo
On Thu, Nov 19, 2015 at 1:11 PM, Ken Hammer wrote: > y = 49%13 > print y > 10 Actually, let me pretend for a moment that I don't know what the modulus operator is. Why do we get 10 here? Can you verbalize the reason? Can you modify this example above to use the modulus operator with "10" on

Re: [Tutor] Modulus Operator ?

2015-11-19 Thread Alan Gauld
On 19/11/15 21:11, Ken Hammer wrote: ...The 2nd below mystifies me. How do I use "x % 10" and "x % 100" ... Also, you can extract the right-most digit or digits from a number. > For example, x % 10 yields the right-most digit of x (in base 10). I understand these: x = 49/13 print x 3 > >

Re: [Tutor] unittest not working

2015-11-19 Thread Dave P
On Thu, Nov 19, 2015 at 8:25 AM, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing

[Tutor] Modulus Operator ?

2015-11-19 Thread Ken Hammer
A text for Python 2.7 includes these two paragraphs. The first I understand. The 2nd below mystifies me. How do I use "x % 10" and "x % 100" in the context of the examples I've created following the paragraphs? "The modulus operator turns out to be surprisingly useful. For example, you can

Re: [Tutor] unittest not working

2015-11-19 Thread Oscar Benjamin
On 19 November 2015 at 13:25, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing som

Re: [Tutor] unittest not working

2015-11-19 Thread Peter Otten
Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, > so I'm sure I'm missing something, I'm just not sure what

Re: [Tutor] Using sorted in Python 3.3.5

2015-11-19 Thread Alan Gauld
On 19/11/15 15:31, Greg Christian wrote: I’m trying to sort a list of tuples based on the second item in the tuple. When I run this in IDLE I get the correct output; however, when running inside of a program, and calling the counter() function, sorted does not seem to work? Any ideas on why th

Re: [Tutor] Using sorted in Python 3.3.5

2015-11-19 Thread Mark Lawrence
On 19/11/2015 15:31, Greg Christian wrote: I’m trying to sort a list of tuples based on the second item in the tuple. When I run this in IDLE I get the correct output; however, when running inside of a program, and calling the counter() function, sorted does not seem to work? Any ideas on why

Re: [Tutor] Strange error

2015-11-19 Thread Alan Gauld
On 19/11/15 10:06, jarod_v6--- via Tutor wrote: I have this error In [381]: len(Span) --- TypeError Traceback (most recent call last) in () > 1 len(Span) TypeError: 'str' object is not

[Tutor] unittest not working

2015-11-19 Thread Mike
I'm trying to unit test a self-built regular expression processor for an assignment. I'm trying to set up unit tests for the package, but it's not executing them. This is my first time trying to use the unittest module, so I'm sure I'm missing something, I'm just not sure what. I even put a test c

[Tutor] Using sorted in Python 3.3.5

2015-11-19 Thread Greg Christian
I’m trying to sort a list of tuples based on the second item in the tuple. When I run this in IDLE I get the correct output; however, when running inside of a program, and calling the counter() function, sorted does not seem to work? Any ideas on why this works in IDLE and not in program would b

Re: [Tutor] Strange error

2015-11-19 Thread Peter Otten
jarod_v6--- via Tutor wrote: > HI!! > This is my list: > > In [378]: type(Span) > Out[378]: list > > In [379]: Span > Out[379]: > [['M02898:39:0-AH4BK:1:2107:17412:10850', > 'M02898:39:0-AH4BK:1:2117:15242:18766', > 'M02898:39:0-AH4BK:1:1112:21747:21214', > 'M02898:

[Tutor] Strange error

2015-11-19 Thread jarod_v6--- via Tutor
HI!! This is my list: In [378]: type(Span) Out[378]: list In [379]: Span Out[379]: [['M02898:39:0-AH4BK:1:2107:17412:10850', 'M02898:39:0-AH4BK:1:2117:15242:18766', 'M02898:39:0-AH4BK:1:1112:21747:21214', 'M02898:39:0-AH4BK:1:2112:5119:9813', 'M02898:39:00