Using 'Or'

Alister alister.ware at ntlworld.com
Sat Jan 16 09:06:56 EST 2016


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 the 'or', please help!
>
> From,
> Kitten Corner
>

Conditional operators (or and not == etc.) need to be used in a test

how else would you expect you print statement to be able to decided 
which to print?

see if you can work through the code below

food="input food ?"
if food =='pie' or food=='donuts':
	print ('I like %s'%food)
else:
	print ('I dont like %s'%food'




More information about the Python-list mailing list