a_list = ["Black Bean Noodles" and "Spicy Seafood Noodles"]
b_list = ["Fried rice", "Mapa Tofu"]
c_list = ["Sushi", "Fried food"]
...
z_list = ["Some", "Element"]
def example():
~~~
When there are several lists like above,
example('jjamppong')
["Black Bean Noodles" and "Spicy Seafood Noodles"] Output
example ('Mapa Tofu')
["Fried rice", "Mapa Tofu"] Output
example ('Fried')
["Sushi", "Fried food"] Output
I want to write a code that works like this.
all_list = [['a', 'b', 'c'], ['a', 'd', 'e'], ['b','g','e']]
def example(word):
l = []
for lst in all_list:
if word in lst:
l.append(lst)
return l
print(example('a')) # [['a', 'b', 'c'], ['a', 'd', 'e']]
print(example('e')) # [['a', 'd', 'e'], ['b', 'g', 'e']]
a_list = ["Black Bean Noodles" and "Spicy Seafood Noodles"]
b_list = ["Fried rice", "Mapa Tofu"]
all_list = []
all_list.append(a_list)
all_list.append(b_list)
def example(_txt):
for i in range(0,len(all_list)):
for j in range(0, len(all_list[i])):
if _txt == all_list[i][j]:
return all_list[i][j]
print(example('jjamppong'))
'''
===============
Jjambbong
'''
I tried it on the level that doesn't hurt the original code I don't know anything about nose.
© 2025 OneMinuteCode. All rights reserved.