Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4253208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:54:55+00:00 2026-05-21T04:54:55+00:00

I have 2 lists: first is list that I need to work with and

  • 0

I have 2 lists: first is list that I need to work with and the second is list of -1.
First of all I need to find the remainder of the divison of the number (number is len(lst)) and put it to the position (remainder of the divisor) in the list of -1. If there is already element, then to the next position in the list (if the next position is not empty, to the next and so on until it finds a position). How to realize the part that is in bold?

# -*- coding: utf-8 -*-
def fun(lst):
    count = [-1] * (len(lst) + 1)
    jar = []
    for i in range(len(lst)):
        jar.append(lst[i]%(len(lst) + 1))
        if count[jar[i]] == -1:
            count[jar[i]] = jar[i]
        else:
            arv[jar[i] + 1] = jar[i] # problem starts here
    print jar 

lst = [26, 53, 12, 65, 39, 6]
lst = fun(lst)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:54:55+00:00Added an answer on May 21, 2026 at 4:54 am

    You introduce arv, but you never assigned it a dict. Since it is a dict, assign arv as:

    arv = {}
    

    I would also use:

    for i,elem in enumerate(lst):
    

    You can now iterate over lst, while also knowing its position.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a group of radio buttons that when clicked need to display
So i have a listbox that i have there for a list of proxies.
I have a couple of super simple databases. Basically they all consist of single
I need some help :) I have a tab activity with four sub activities.
First I do know about 'import'. When I try 'import' it doesn't work. What
I have a page that is dynamically built by the database. For each thing
I've got two small structural issues that I'm not sure how to handle given
I need to allow users to choose/input authors associated with a given publication and
I'm working on an windows app. This app contains a dynamic list of names,
This is my first day playing with CI and I really like it so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.