Return the index of the first integer in items that is less than its index, or -1 if no such integer exists in items. >>> small_index([2, 5, 7, 99, 6]) -1

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 3E
icon
Related questions
Question

def small_index(items: list[int]) -> int:
"""
Return the index of the first integer in items that is less than its index,
or -1 if no such integer exists in items.

>>> small_index([2, 5, 7, 99, 6])
-1
>>> small_index([-5, 8, 9, 16])
0
>>> small_index([5, 8, 9, 0, 1, 3])
3
"""

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr