'TypeError: descriptor 'append' for 'list' objects doesn't apply to a 'float' object

I am trying to solve a problem and trying to get input from the user and append that in a list. But i am getting this error message.

if __name__ == '__main__':
    list2 = []
    lsit = []
    for _ in range(int(input())):
        name = input()
        score = float(input())
        
        list.append(score)
        list.append(name)
        list2.append(list)  
    print(list2)


Solution 1:[1]

I just had to change the name from list to something else. In my case I renamed it to 'list1'.

if __name__ == '__main__':
    list2 = []
    for _ in range(int(input())):
        name = input()
        score = float(input())
        list1 = []
        list1.append(score)
        list1.append(name)
        list2.append(list1)  
    print(list2)

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 Zahid Hasan