LogFAQs > #963054820

LurkerFAQs, Active DB, DB1, DB2, DB3, DB4, DB5, DB6, DB7, DB8, DB9, Database 10 ( 02.17.2022-12-01-2022 ), DB11, DB12, Clear
Topic List
Page List: 1
TopicITT: I document my Python coding journey
SamusGlory
02/28/22 5:27:48 PM
#14:


SomeLikeItHoth posted...
How far along are you in Python Crash Course?

Still learning about the if statements. I just learned that you don't really need to have the "else" at the end and you can just continue on with the "elif"

I just created this little code for the grocery list.

grocery_list = ['eggs', 'milk', 'bread', 'cheese']

if 'eggs' in grocery_list:
print("Adding eggs into the shopping cart.")
if 'milk' in grocery_list:
print("Adding milk into the shopping cart.")
if 'bacon' in grocery_list:
print("Adding bacon into the shopping cart.")
if 'bread' in grocery_list:
print("Adding bread into the shopping cart.")
if 'cheese' in grocery_list:
print("Adding cheese into the shopping cart.")
if 'apples' in grocery_list:
print("Adding apples into the shopping cart.")

print("\nFinished adding the items into the shopping cart. Are you ready to check out?")

This should exclude the bacon and apples from being in the shopping cart.


---
My PC: https://pcpartpicker.com/list/pDLqgw
... Copied to Clipboard!
Topic List
Page List: 1