pub-3785248829033902 | Python: Groceries list | - Big data with Python

| Python: Groceries list |

The best way to learn new things is to take a practical approach of the things you want to learn. Here is a fragment of code that demonstrates the use of If statement in Python:



Æ’ python command

#1
groceries = {'Quinoa' , 'Kale' , 'Eggs' , 'Nuts', 'Vodka'}
print(groceries)

#2
if 'Milk' in groceries:
    print('yes')
else: print('no milk at all')

#3
if 'Eggs' in groceries:
    print('yes')
else: print('no at all')

output

{'Nuts', 'Quinoa', 'Vodka', 'Eggs', 'Kale'}
no milk at all
yes  


First