Help me, please with the loop
Hello. Can anybody help me with this question: How can I assign values to the variables in the loop? I mean, I want to get some variables like a1=..., a2=..., a3=..., a4=... in the loop (i from 1 to 4)?
Link your code here so people can see clearly what's the problem and offer solutions :)
for i in range(1,5): a[i] = i*i i will take the values from 1-4 so, a[i] means a ... a and then you can do the assignment
Try creating an array.
i've tried,but there is an error: TypeError: 'str' object does not support item assignment