n = int(input())
pythonName = []
for i in range(n):
a = input("Enter the Name:")
b = int(input("Enter the Score:"))
pythonName.append(a)
for j in range(n):
pythonName[i].append(b)
print(pythonName)
------------Error------------
AttributeError Traceback (most recent call last)
<ipython-input-12-e737ad48a8fc> in <module>
6 pythonName.append(a)
7 for j in range(n):
----> 8 pythonName[i].append(b)
9
10 print(pythonName)
AttributeError: 'str' object has no attribute 'append'
I am Creating a Nested List where I am trying to get from users. I want to desire output like this.
python students = [['Harry', 37.21], ['Berry', 37.21], ['Tina', 37.2], ['Akriti', 41], ['Harsh', 39]]