Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

lopus

  • 3 years ago

hi everybody i need help you. need modify a tuple. for example x=() i want add x=(1,2,3,4,5) for i in range(5): x=(i,)+x[i:] ???????

  • This Question is Closed
  1. RoamingBlue
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    tuples are immutable so you need to completely recreate it to add a value like this: x=() for i in range(5): x=x+(i,)

  2. lopus
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    men thanks

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy