Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Select fruits
#python 3.5.2 table = [ {'fruit': 'apple'}, {'fruit': 'orange'}, {'fruit': 'kiwi'}, {'fruit': 'banana'} ] fruits = set((item["fruit"] for item in table)) try: user_input = "" while user_input != 'exit': user_input = input('> ') words = user_input.split() if words and words[0] == "select": for word in words[1:]: if word in fruits: print(word) break else: print("You didn't entered any fruit name in the table"); except Exception as e: print(e)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
get_sets_of_sum
Play
10
Monthly Calendar
Hesap makinesi
Set
new traceback.py
Game4
single_digit
init constructor
Please log in to post a comment.