warn_investment_list = ["Microsoft", "Google", "Naver", "Kakao", "SAMSUNG", "LG"]
word = input ("input: ")
if word in warn_investment_list:
print ("This is an investment warning stock")
else:
print ("Not an investment warning stock")
=============================================================================== This code says that if you enter Microsoft, it is not an investment warning item.
To recognize even when entering lowercase letters like Microsoft
Should I write word.lower
?
>>> warn_investment_list = ["Microsoft", "Google", "Naver", "Kakao", "SAMSUNG", "LG"]
>>> l = [x.lower() for x in warn_investment_list]
>>> l
['microsoft', 'google', 'naver', 'kakao', 'samsung', 'lg']
© 2024 OneMinuteCode. All rights reserved.