Function receiving and modifying a list without returning it [closed]












-3















There is a question around here with a similar title, however it refers to something different.



Example:



lst = [1,2,3,4,2]
def drop_duplicates(lst):
# Write the rest of the code for question 3a below here.
lst.pop(0)
print lst


>>> [1, 2, 3, 4, 2]


As you can see my issue is that it is not being modified. I've been told that is possible to accomplish this without adding a return statement or using Global. Would love to have some insight into this.



Thanks!










share|improve this question













closed as off-topic by timgeb, jpp, Austin, chepner, pushkin Nov 19 '18 at 17:42


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – timgeb, jpp, Austin, chepner, pushkin

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 3





    You never called your function.

    – timgeb
    Nov 19 '18 at 17:23











  • Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

    – chepner
    Nov 19 '18 at 17:35


















-3















There is a question around here with a similar title, however it refers to something different.



Example:



lst = [1,2,3,4,2]
def drop_duplicates(lst):
# Write the rest of the code for question 3a below here.
lst.pop(0)
print lst


>>> [1, 2, 3, 4, 2]


As you can see my issue is that it is not being modified. I've been told that is possible to accomplish this without adding a return statement or using Global. Would love to have some insight into this.



Thanks!










share|improve this question













closed as off-topic by timgeb, jpp, Austin, chepner, pushkin Nov 19 '18 at 17:42


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – timgeb, jpp, Austin, chepner, pushkin

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 3





    You never called your function.

    – timgeb
    Nov 19 '18 at 17:23











  • Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

    – chepner
    Nov 19 '18 at 17:35
















-3












-3








-3








There is a question around here with a similar title, however it refers to something different.



Example:



lst = [1,2,3,4,2]
def drop_duplicates(lst):
# Write the rest of the code for question 3a below here.
lst.pop(0)
print lst


>>> [1, 2, 3, 4, 2]


As you can see my issue is that it is not being modified. I've been told that is possible to accomplish this without adding a return statement or using Global. Would love to have some insight into this.



Thanks!










share|improve this question














There is a question around here with a similar title, however it refers to something different.



Example:



lst = [1,2,3,4,2]
def drop_duplicates(lst):
# Write the rest of the code for question 3a below here.
lst.pop(0)
print lst


>>> [1, 2, 3, 4, 2]


As you can see my issue is that it is not being modified. I've been told that is possible to accomplish this without adding a return statement or using Global. Would love to have some insight into this.



Thanks!







python python-2.7 function






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 '18 at 17:22









Moriel MankevichMoriel Mankevich

1




1




closed as off-topic by timgeb, jpp, Austin, chepner, pushkin Nov 19 '18 at 17:42


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – timgeb, jpp, Austin, chepner, pushkin

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by timgeb, jpp, Austin, chepner, pushkin Nov 19 '18 at 17:42


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – timgeb, jpp, Austin, chepner, pushkin

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 3





    You never called your function.

    – timgeb
    Nov 19 '18 at 17:23











  • Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

    – chepner
    Nov 19 '18 at 17:35
















  • 3





    You never called your function.

    – timgeb
    Nov 19 '18 at 17:23











  • Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

    – chepner
    Nov 19 '18 at 17:35










3




3





You never called your function.

– timgeb
Nov 19 '18 at 17:23





You never called your function.

– timgeb
Nov 19 '18 at 17:23













Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

– chepner
Nov 19 '18 at 17:35







Suppose I replaced the def statement with drop_duplicates = operater.methodcaller('pop', 0). Would you still be surprised that lst remained unmodified, given that the definition doesn't mention lst at all.

– chepner
Nov 19 '18 at 17:35














1 Answer
1






active

oldest

votes


















1














You need to call your function



lst = [1,2,3,4,2]
def drop_duplicates(lst):
# Write the rest of the code for question 3a below here.
lst.pop(0)
drop_duplicates(lst)
print lst



[2, 3, 4, 2]







share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You need to call your function



    lst = [1,2,3,4,2]
    def drop_duplicates(lst):
    # Write the rest of the code for question 3a below here.
    lst.pop(0)
    drop_duplicates(lst)
    print lst



    [2, 3, 4, 2]







    share|improve this answer




























      1














      You need to call your function



      lst = [1,2,3,4,2]
      def drop_duplicates(lst):
      # Write the rest of the code for question 3a below here.
      lst.pop(0)
      drop_duplicates(lst)
      print lst



      [2, 3, 4, 2]







      share|improve this answer


























        1












        1








        1







        You need to call your function



        lst = [1,2,3,4,2]
        def drop_duplicates(lst):
        # Write the rest of the code for question 3a below here.
        lst.pop(0)
        drop_duplicates(lst)
        print lst



        [2, 3, 4, 2]







        share|improve this answer













        You need to call your function



        lst = [1,2,3,4,2]
        def drop_duplicates(lst):
        # Write the rest of the code for question 3a below here.
        lst.pop(0)
        drop_duplicates(lst)
        print lst



        [2, 3, 4, 2]








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 17:26









        Garvita TiwariGarvita Tiwari

        468211




        468211

















            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?