LogFAQs > #963096783

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
03/02/22 3:57:50 AM
#18:


warlock7735 posted...
One other trick you can do is something like..... (I don't use python and am on my phone so syntax might be funky)

colors= ['red', 'green', 'blue', 'yellow', 'purple', 'orange']
Liked_colors=['red', 'blue']

for color in colors:
If color in Liked_colors:
Print(f"I like {color}")

but you'll want to be aware that you're iterating over the second array for every time you step over the first. It's just a convenient way of not needing to make a case for every output.

Thanks man, I will keep that in mind.

I've also been practicing SQL too. Today has been a productive day since I've been practicing SQL and Python for many hours. I learned that in order to check if the list is empty or not, I should type out the code like this.

https://gamefaqs.gamespot.com/a/user_image/5/4/2/AASCCgAAC_DO.jpg

https://gamefaqs.gamespot.com/a/user_image/5/4/3/AASCCgAAC_DP.jpg

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