If the second parameter exists in the first list parameter, return the index of the first occurrence of the item found in the given list. If it does not, return -1

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter2: Introduction To Systems Architecture
Section: Chapter Questions
Problem 11VE
icon
Related questions
Question

In python

Q1b.
Function name
question_1b
Parameter(s)/
argument(s)
In this order,
1. a list
2. a str or an integer, item
Return value
1 integer
Detailed
If the second parameter exists in the first list parameter, return the index
of the first occurrence of the item found in the given list.
If it does not, return -1
description
Example usage
print(question_1b([1,4,"abc",3,2,9,-1,4],4))
Transcribed Image Text:Q1b. Function name question_1b Parameter(s)/ argument(s) In this order, 1. a list 2. a str or an integer, item Return value 1 integer Detailed If the second parameter exists in the first list parameter, return the index of the first occurrence of the item found in the given list. If it does not, return -1 description Example usage print(question_1b([1,4,"abc",3,2,9,-1,4],4))
Example usage
output
Transcribed Image Text:Example usage output
Expert Solution
Step 1

Program:

Create function that will return the first occurrence or index of the item found in the list and if not found then return -1.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning