Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Today at 10:50 AM
Ad icon
Cam ෂෝ කරන්න ආස කෙල්ලෝ
vip video seller srilanka
Updated:
Today at 2:17 AM
Cam show job
vip video seller srilanka
Updated:
Today at 2:01 AM
Vip විඩීයෝ තියේ හොරෙන් රෙකෝඩ් කරපුවා
vip video seller srilanka
Updated:
Today at 1:26 AM
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Monday at 12:26 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Help! Python programmers.
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="IreshMM" data-source="post: 18991087" data-attributes="member: 497787"><p><span style="color: Blue"><span style="font-size: 18px">Actually, I'm not an expert. So I need your help to understand this. <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /></span></span></p><p>[CODE]lst=[4, 5, 5, 4]</p><p>nwlst=lst</p><p>for i in lst:</p><p> print i</p><p> nwlst.remove(i)[/CODE]</p><p></p><p><span style="font-size: 15px">Expected result :</span></p><p>4</p><p>5</p><p>5</p><p>4</p><p></p><p><span style="font-size: 15px">but I got :</span></p><p></p><p>4</p><p>5</p><p></p><p><span style="font-size: 15px">Once I removed the statement :</span> nwlst.remove(i)</p><p><span style="font-size: 15px">I got the expected result.</span></p><p></p><p><span style="color: Blue"><span style="font-size: 18px">Can anyone explain this? How this happens? </span><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /><img src="/styles/default/xenforo/smilies/default/confused.gif" class="smilie" loading="lazy" alt=":confused:" title="Confused :confused:" data-shortname=":confused:" /></span></p></blockquote><p></p>
[QUOTE="IreshMM, post: 18991087, member: 497787"] [COLOR="Blue"][SIZE="5"]Actually, I'm not an expert. So I need your help to understand this. :)[/SIZE][/COLOR] [CODE]lst=[4, 5, 5, 4] nwlst=lst for i in lst: print i nwlst.remove(i)[/CODE] [SIZE="4"]Expected result :[/SIZE] 4 5 5 4 [SIZE="4"]but I got :[/SIZE] 4 5 [SIZE="4"]Once I removed the statement :[/SIZE] nwlst.remove(i) [SIZE="4"]I got the expected result.[/SIZE] [COLOR="Blue"][SIZE="5"]Can anyone explain this? How this happens? [/SIZE]:confused::confused::confused::confused::confused:[/COLOR] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom