> For the complete documentation index, see [llms.txt](https://ankit-apdc.gitbook.io/python-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ankit-apdc.gitbook.io/python-1/part-1-basics/python-problem-practice-i.md).

# Python Problem Practice I

## Find an index of number d in array arr

* Example 1:&#x20;
  * Input: arr = \[4,2,6,8,16,2,40,51], d = 16
  * Output: 4
* Example 2:
  * Input: arr = \[6,12,73,31,74,41], d = 91
  * Output = -1

## Find largest element index in list arr

* Example 1:&#x20;
  * Input: arr = \[4,2,6,8,16,2,40,51]
  * Output: 51
* Example 2:
  * Input: arr = \[6,12,73,31,74,41]
  * Output: 74

## Write a program to print all 13 divisible numbers between n1 and n2

* Example 1:&#x20;
  * Input: n1 = 30, n2 = 321
  * Output:&#x20;
* Example 2:
  * Input: n1 = 135, n2 = 1035
  * Output:&#x20;

## Write a function called fizz\_buzz that takes a number

* If the number is divisible by 3, it should return “Fizz”.
* If it is divisible by 5, it should return “Buzz”.
* If it is divisible by both 3 and 5, it should return “FizzBuzz”.

Otherwise, it should return the same number.

## Write a function that prints all the prime numbers between 0 and n

where n is an integer

## Find peak element from an array

A peak element is an element that is strictly greater than its neighbors.

Given an integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

You may imagine that nums\[-1] = nums\[n] = -∞.

**Example 1**:

Input: nums = \[1,2,3,1] Output: 2 Explanation: 3 is a peak element and your function should return the index number 2.

**Example 2**:

Input: nums = \[1,2,1,3,5,6,4] Output: 1 or 5

## You can walk back and forth between rooms freely. Return true if and only if you can enter every room

There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.

Formally, each room i has a list of keys rooms\[i], and each key rooms\[i]\[j] is an integer in \[0, 1, ..., N-1] where N = rooms.length. A key rooms\[i]\[j] = v opens the room with number v.

Initially, all the rooms start locked (except for room 0).

**Example 1**:

Input: \[\[1],\[2],\[3],\[]] Output: true Explanation:\
We start in room 0, and pick up key 1. We then go to room 1, and pick up key 2. We then go to room 2, and pick up key 3. We then go to room 3. Since we were able to go to every room, we return true. Example 2:

Input: \[\[1,3],\[3,0,1],\[2],\[0]] Output: false Explanation: We can't enter the room with number 2.

## Reference for More Questions

For basic problems, here you can find problems topicwise

### InterviewBit

{% embed url="<https://www.interviewbit.com/courses/programming/>" %}

### Hackerank: Basics and Others

{% embed url="<https://www.hackerrank.com/domains/python>" %}

### LeetCode: 30 Days 30 Problems Challenge and Others

Here 30-day challenge, 30 problems for 30 days, from basics to a decent level. Start here

{% embed url="<https://leetcode.com/explore/featured/card/may-leetcoding-challenge-2021/598/week-1-may-1st-may-7th/3730/>" %}

##


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ankit-apdc.gitbook.io/python-1/part-1-basics/python-problem-practice-i.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
