Re: Using 'Or'

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 9:47 AM, Alister wrote: > On 16/01/16 21:53, Steven D'Aprano wrote: >> >> On Sun, 17 Jan 2016 01:06 am, Alister wrote: >> >>> Conditional operators (or and not == etc.) need to be used in a test >> >> >> Technically, that is incorrect. > > yes but the op is confused in his

Re: Using 'Or'

2016-01-16 Thread Bernardo Sulzbach
On Sat, Jan 16, 2016 at 8:47 PM, Alister wrote: >> >> default = "I like Brussels sprouts." >> message = random.choice(["", "I like boiled cabbage."]) >> print( message or default ) >> >> >> > I hope I never see production code like that > I agree. If you are going to use spaces after '(' and befo

Re: Using 'Or'

2016-01-16 Thread Alister
On 16/01/16 21:53, Steven D'Aprano wrote: On Sun, 17 Jan 2016 01:06 am, Alister wrote: Conditional operators (or and not == etc.) need to be used in a test Technically, that is incorrect. yes but the op is confused in his usage enough at present how else would you expect you print stateme

Re: Using 'Or'

2016-01-16 Thread Steven D'Aprano
On Sun, 17 Jan 2016 01:06 am, Alister wrote: > Conditional operators (or and not == etc.) need to be used in a test Technically, that is incorrect. > how else would you expect you print statement to be able to decided > which to print? default = "I like Brussels sprouts." message = random.cho

Re: Using 'Or'

2016-01-16 Thread Alister
On 15/01/16 20:24, Kitten Corner wrote: Hi, I have python version 3.5.1 and I am working on a project, I'm trying to make it by using the 'or' sequence, I'm trying to make it do 1 thing or the other, here's an example: print('i like pie' or 'i like donuts'), it only does the thing that's before t

Re: Using 'Or'

2016-01-16 Thread Marko Rauhamaa
Christian Gollwitzer : > Am 15.01.16 um 21:24 schrieb Kitten Corner: >> print('i like pie' or 'i like donuts') > >> it only does the thing that's before the 'or', please help! > > I think you misunderstand what "or" does. It evaluates the first > expression, and if this is false, it evaluates the

Re: Using 'Or'

2016-01-16 Thread Steven D'Aprano
On Sat, Jan 16, 2016 at 7:24 AM, Kitten Corner wrote: > Hi, I have python version 3.5.1 and I am working on a project, I'm trying > to make it by using the 'or' sequence, I'm trying to make it do 1 thing > or the other, here's an example: print('i like pie' or 'i like donuts'), > it only does the

Re: Using 'Or'

2016-01-16 Thread Christian Gollwitzer
Am 15.01.16 um 21:24 schrieb Kitten Corner: Hi, I have python version 3.5.1 and I am working on a project, I'm trying to make it by using the 'or' sequence, I'm trying to make it do 1 thing or the other, here's an example: print('i like pie' or 'i like donuts') it only does the thing that's

Re: Using 'Or'

2016-01-16 Thread Chris Angelico
On Sat, Jan 16, 2016 at 7:24 AM, Kitten Corner wrote: > Hi, I have python version 3.5.1 and I am working on a project, I'm trying > to make it by using the 'or' sequence, I'm trying to make it do 1 thing or > the other, here's an example: print('i like pie' or 'i like donuts'), it > only does the

Using 'Or'

2016-01-16 Thread Kitten Corner
Hi, I have python version 3.5.1 and I am working on a project, I'm trying to make it by using the 'or' sequence, I'm trying to make it do 1 thing or the other, here's an example: print('i like pie' or 'i like donuts'), it only does the thing that's before the 'or', please help! From, Kitten Corner