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 8657209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:27:57+00:00 2026-06-12T15:27:57+00:00

from the following array how can i get an output as stated arr=[harry,sally,tom] harry

  • 0

from the following array how can i get an output as stated

arr=["harry","sally","tom"]

harry
harry
harry
sally
sally
tom

sally
sally
sally
tom
tom
harry

tom
tom
tom
harry
harry
sally

what ive tried

>>> for i in range(len(arr)):
...     print arr[i] * 3
...     print arr[i+1]*2
...     print arr[i-1] 
... 

Traceback (most recent call last):
File "<stdin>", line 3, in <module>
IndexError: list index out of range
  • 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-06-12T15:27:58+00:00Added an answer on June 12, 2026 at 3:27 pm

    Use the modulus operator to wrap around to the beginning of the list, or double the list but use the length of the original.

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

Sidebar

Related Questions

The following array is output from my db. $this->db->select('code')->from('table'); $array = $this->db->get()->result_array(); //Output: Array
I'm using the following code to get an array with all sub directories from
I am confused from the result of the following code: I can't get my
I am trying to get the following output format from a CI query and
I have the following array response from a server to an android app. [
The ANSI C grammar from -link- give me the following rules for array declarations:
I have the following php code that gets a serialized array from a mysql
I want to get distance text from following link. i have used NSXML parsing
I have retrieved the following output from a service. Output: OK: set username OK:
I've tried everything I can think of and can't get anything to work. I

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.