On Mon, Jul 4, 2016 at 9:56 PM, Danny Yoo wrote:
> So the extra trailing comma in a 1-tuple parenthesized expression is
> just there to make it different looking, to disambiguate it from the
> use of parentheses for expression grouping.
The comma is the distinguishing element of non-empty tuple l
On Tue, Jul 05, 2016 at 12:47:27AM +0100, Alan Gauld via Tutor wrote:
> > I then tried using
> >
> > elif keycode == 27:
> >
> > but this statement didn't work.
>
> I'm not sure why that didn't work.
> What exactly happened? Did you get a different error message?
> If so what?
I expect that t
On Mon, Jul 4, 2016 at 1:38 PM, Colby Christensen
wrote:
> I'm sure this is something simple but I'm missing it.
> When I check the statement with two values, the if statement works. However,
> for the statement with one value I get an error.
> keycode = event.GetKeyCode()
> if keycode in (13, 37
On 04/07/16 21:38, Colby Christensen wrote:
> elif keycode in (47, 392):
> self.div()
> elif keycode in (27):
> self.clear_all()
I meant to say...
> I then tried using
>
> elif keycode == 27:
>
> but this statement didn't work.
I'm not sure why that didn't work.
What exactly happened
I believe the problem is what the error says: you're passing an int. When you
give it two values, you're giving it a tuple, like (1, 2). That's a list type
object in Python, and the 'in' keyword has to operate on lists. Therefore, it
works.
When you give it one value, though, you're giving it a
On 07/04/2016 03:38 PM, Colby Christensen wrote:
I'm sure this is something simple but I'm missing it.
When I check the statement with two values, the if statement works. However,
for the statement with one value I get an error.
keycode = event.GetKeyCode()
if keycode in (13, 370):
self.ent
On 04/07/16 21:38, Colby Christensen wrote:
> File "/home/colby/Calculator/Calculator_betaV3.py", line 110, in OnKeyPress
> elif keycode in (27):
> TypeError: argument of type 'int' is not iterable
The problem is that 'in' needs a collection to test. (27) is not a
single element tuple but j
I'm sure this is something simple but I'm missing it.
When I check the statement with two values, the if statement works. However,
for the statement with one value I get an error.
keycode = event.GetKeyCode()
if keycode in (13, 370):
self.enter()
elif keycode in (43, 388):
self.add()
elif