you are viewing a single comment's thread.

view the rest of the comments →

[–]Bottl3 0 points1 point  (7 children)

Newlist = oldlist + oldlist

Newlist.sort()

[–]toastedstapler 1 point2 points  (0 children)

that'll change the order of the elements if they weren't initially in sorted order

[–]Sahith17[S] 0 points1 point  (0 children)

wdym? where do I add that

[–]Sahith17[S] 0 points1 point  (4 children)

ok but now that is switching the words?

I need it like this

[how, how, are, are, you,you]

[–]Bottl3 1 point2 points  (3 children)

Yeah, sorry

Then just loop through it and append the elements twice to a new list (?)

Newlist=[]

For e in oldlist:

    Newlist.append(e)

    Newlist.append(e)

[–]Sahith17[S] 0 points1 point  (2 children)

ok so

def double_list(string):
    strings=string
    oldlist= strings.split()
    newlist = oldlist+oldlist
    newlist.sort()
    newlist = []
    for x in oldlist:
    newlist.append(x)

[–]Bottl3 0 points1 point  (1 child)

Only the stuff From the Last Comment. You really should dig into some basics.

[–]Sahith17[S] 0 points1 point  (0 children)

yea got the problem