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?
Completing code to confirm item presence in a list
Report a typo
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") ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.