Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is the task: Write a function to take a list of numbers and a number to check if the number is in the list
This is the task:
Write a function to take a list of numbers and a number to check if the number is in the list or not.
Print out the index of the element, if it exists in the list, and the message 'The element does not exist in the list', otherwise.
This is my code:
How can i change my code to avoid using the list built in functions for finding elements? (This is python coding language)
\#\#Your code here list 1=[1,2,3,5,6,9,12,34,38,45,49] def functionName (x) : result =[] for index in range(len(list 1)) : if x in 1 ist 1 : i= ist 1. index (x) result.append (i) print (result, x ) else: print('The element does not exist in the list') return functionlare (38) [8] 38Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started