Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am getting Memory ERROR when running this program

just met this question online trying to run it am getting memory error. any idea?

inputs= ['nodejs','reactjs','vuejs']
print(inputs)
for i in inputs:
    inputs.append(i.upper())
print(inputs)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You are making an infinite loop.
You should do this instead:

inputs= ['nodejs','reactjs','vuejs']
print(inputs)

upper_inputs = []
for i in inputs:
    upper_inputs.append(i.upper())

print(upper_inputs)

or even better:

inputs = ['nodejs','reactjs','vuejs']
print(inputs)

upper_inputs = list(map(lambda x: x.upper(), inputs))
print(upper_inputs)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading