Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16862

Any idea why append in loop is not working.? [duplicate]

$
0
0

Hi I am new to coding so need your help.Any idea why append in loop is not working.?

code:x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)

Expected output:
['ab', 'cd', 'AB', 'CD']

but not getting any output, and compiler runs out of ram

Thanks


Viewing all articles
Browse latest Browse all 16862


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>