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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:35:21+00:00 2026-05-28T03:35:21+00:00

Right I am a complete beginner here, trying to work through various python tutorials

  • 0

Right I am a complete beginner here, trying to work through various python tutorials and a lot of them are great. However none of them have much of a consolidated approach to learning, where one skill builds on another. They all seem to show you things in silo. All I am trying to do is concatenate a string with an integer that is held in an array. Here is the code:

text = 'product_price_'
numberArray = [1,2,3,4,5,6,7,8,9,10]


for i in numberArray:
  print text + str(numberArray[i])

This kind of works, giving me the result:

product_price_2
product_price_3
product_price_4
product_price_5
product_price_6
product_price_7
product_price_8
product_price_9
product_price_10
Traceback (most recent call last):
  File "/Users/me/Documents/Programming/python/eclipse/workspace/concat.py", line 8, in <module>
print text + str(numberArray[i])
IndexError: list index out of range

Like I say this is really simple stuff. I can concatenate, I can print an array but do both??

Can anyone plug this gap in my knowledge for me?

Thanks

  • 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-28T03:35:22+00:00Added an answer on May 28, 2026 at 3:35 am

    i contains the value from the array, not the index. So if you want to concatenate the value, try this:

    for i in numberArray:
      print text + str(i)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still a complete beginner in the field of web development and I'm trying
Ok, I am a complete beginner to this, in fact I am still building
I am a complete beginner to ASP.NET and need to know how do I
I am so frustrated right now after several hours trying to find where shared_ptr
I'm a (near complete) beginner, and this is my first foray into encryption -
Regular Expressions are a complete void for me. I'm dealing with one right now
I'm modding a TextMate bundle even though I'm a complete beginner at Ruby. The
Is this the right declaration of findcontrol for complete step of createuserwizard1 ? Dim
I'm a complete JavaScript noob. I am using this right now: $(function() { $(#tabs).tabs({
I'm a complete beginner in Objective-C and Cocoa. I would like to create a

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.