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

  • Home
  • SEARCH
  • 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 7536133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:29:34+00:00 2026-05-30T06:29:34+00:00

I have to use a FOR loop like this x=0 for i in range(22):

  • 0

I have to use a FOR loop like this

x=0
for i in range(22):
    SOME OPERATION

And than store the value of operation in a list like [0,0,0,0,0]
depending upon the OPERATION results +1 will be done to any of 5 values in list.

The problem is that I need a list for every iteration. Could you please help me with naming/initializing a list with name like list1, list2 and so on till list 22. SO that I can keep on +1 to list at any of five values

AK

  • 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-30T06:29:37+00:00Added an answer on May 30, 2026 at 6:29 am

    If you need a group of named lists then it sounds like you want a dictionary:

    myLists = dict()
    for x in range(22):
        myLists[ 'list%d' % x ] = [0,0,0,0,0]
    

    If you’d rather do it with a list of lists:

    myLists = list()
    for x in range(22):
        myLists.append( [0,0,0,0,0] )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two nested loop in XSL like this, at this moment I use
i have two foreach loop to display some data, but i want to use
I have a thread, that processes incomming messages (endless loop). For this, I use
Say I have a loop like this: for (int i = 0; i <
I have an network application which uses a select loop like this: bool shutdown=false;
I have a for loop like this : String myString = 123456789; String prefix
In PHP I can use a foreach loop such that I have access to
Does anyone use have a good regex library that they like to use? Most
i have few variables like this: self.lamp_1 self.lamp_2 self.lamp_3 self.lamp_4 and now i want
How can I have SQL repeat some set-based operation an arbitrary number of times

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.