Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Similar to how character data is encoded as numbers in ASCII, scientific data can also be encoded as characters. You ve been given a list

Similar to how character data is encoded as numbers in ASCII, scientific data can also be encoded as characters. Youve been given a list of strings that represent 42 sensors on an ocean submersible. The 42 sensors are represented by 26 capital letters and 26 lowercase letters. By determining which sensors were triggered by a group of stimuli your organization hopes to hone in on the sources of chemical pollutants in the ocean. Write a function get_indices(sensor, stimulus) that takes two arguments and returns a list of integers. The first argument, sensor, contains a string that is a mix of uppercase/lowercase letters and spaces. The spaces represent gaps where none of the sensors were triggered. The second argument, stimulus, is a string of characters which could be uppercase or lowercase. These are the targets that your organization cares about. If any characters in the second argument stimulus appear in the first argument sensor, your function should return the index where they appear in sensor. If there are no matches or either argument is an empty string, it should return the empty list.
NOTE: this function IS case sensitive. Your solution must use an index loop (either with range(len(lst)) or enumerate(lst)).
Example usage:
>>> get_indices('abtZZfg pQioeQr r r Yi', 'aeiou')
[0,10,11,12,24]
>>> get_indices('abtZZfg pQioeQr r r Yi', 'AEIOU')
[]
>>> get_indices('', 'aetuh')
[]
>>> get_indices('XAPPZXY','xP')
[2,3]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago