coding-quiz-1
---
id: coding-quiz-1
title: Coding Quiz - Finding Rotten Apples
description: Write a function to find rotten apples.
tags:
- Coding Quiz
- List
- Python
- Practice
sidebar_position: 1
isPublic: false
---
# Coding Quiz - Finding Rotten Apples
In this coding quiz, you will write a function to find rotten apples in a basket.
You will receive a list indicating the state of apples and your task is to return a `list of indices` where the apples are rotten.
The apple basket is represented by a list of integers, where rotten apples are denoted as `0`, and fresh apples are indicated by `1`.
<br />
```python title="Write your code"
def solution(apples):
# Write your code here
return
Constraints
-
The input list will only contain elements
0
or1
. -
The list will contain at least one element.
Example of inputs and outputs
-
Input:
[1, 0, 1, 0, 1]
-
Output:
[1, 3]
-
Input:
[1, 0, 0, 1]
-
Output:
[1, 2]
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.