0

Here's what I have:

def reverse(text): opposite = [] for character in text: stuff = opposite.append(character) return stuff

Is there something wrong with this for loop?

0

2 Answers 2

0

Couldn't you use the split method instead it will return a list

text.split()

Or even

list(text)

Which would list out each character

Sign up to request clarification or add additional context in comments.

Comments

0
yourstring='welcome'
l=[]
for char in yourstring:
      l.append(char)
print l

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.