Completing code to confirm item presence in a list

Report a typo

Suppose you have a list of items and you want to check if a user-input item is present in that list or not. The program needs to display a message to the user about the presence or absence of that item in the list. However, some parts of the code are missing. Can you fill the blanks in the code to make it work as intended?

Fill in the gaps with the relevant elements
fruits = ["apple", "banana", "mango"]
user_input = input("Enter a fruit: ")

 user_input  fruits:
    print(f"Yes, {user_input} is in the list")
:
    print(f"No, {user_input} is not in the list")
ifelsein
___

Create a free account to access the full topic