Avatar ·

How to fix it? 'Ints Object is not Subscriptable

📁 Advanced Python Topics

Here is the task: to generate 20 random integers in the range from -5 to 4, to write them down in the cells of the array. Count how many positive, negative and zero values among them. Output the elements of the array and counted quantities to the screen. Here is the text of the error:

  a[i] = int(a[i]) TypeError: 'int' object is not subscriptable  
  import random a = [] for i in range(20): a = random.randint