On Tuesday, March 15, 2016 at 11:05:32 PM UTC+5:30, Peter Otten wrote:
> Indeed. It's still better than
>
> "This is %s a fruit" % (x in x_list and "" or "not")
>
> The bug is intentional; the fix is of course
>
> "This is %s a fruit" % (x in x_list and "most likely" or "probably not")
>
> ;)
Rustom Mody wrote:
> On Tuesday, March 15, 2016 at 2:00:25 PM UTC+5:30, Peter Otten wrote:
>> Rustom Mody wrote:
>>
>> > Others have answered some parts
>> if x in x_list:
>> > ... print("That is a fruit.")
>> > ... else:
>> > ... print("That is not a fruit.")
>> > ...
>> >
>> > How
On Tuesday, March 15, 2016 at 2:00:25 PM UTC+5:30, Peter Otten wrote:
> Rustom Mody wrote:
>
> > Others have answered some parts
> if x in x_list:
> > ... print("That is a fruit.")
> > ... else:
> > ... print("That is not a fruit.")
> > ...
> >
> > However one can distribute the prin
Rustom Mody wrote:
> Others have answered some parts
if x in x_list:
> ... print("That is a fruit.")
> ... else:
> ... print("That is not a fruit.")
> ...
>
> However one can distribute the print out of the if; Thus
>
"This is %s a fruit" % ("" if x in x_list else "not")
Which