#🔒 What’s wrong?

17 messages · Page 1 of 1 (latest)

supple yewBOT
#

@turbid crescent

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

proven egret
#

Yes, but tuples are immutable. You can't append to them.

turbid crescent
#

Thanks

proven egret
#

Really? Show us.

turbid crescent
#

No im asking

proven egret
#

bearing in mind that it will have stopped at the first error.

turbid crescent
#

Yes it did

proven egret
#

Oh, asking. (Use a "?") Yeah, you can't change a tuple once it's made.

hot sequoia
#

tuples can't be changed. it might look like it sometimes, but they can't actually be.

proven egret
#

So:

tup = 1,2,3
tup.sort() # no such method on tuples
tup2 = sorted(tup) # this makes a list from the tuple
turbid crescent
#

What slicing works for tuples which also works for lists

hot sequoia
#

you can 'sort' them for example in the sense that you can create a new tuple that is equivalent to the sorted original

proven egret
#

Slicing makes a new object. The original is unchanged.

turbid crescent
#

Ok

supple yewBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.