'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 1:[1]
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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rovshen Tagangylyjov |
