lundi 13 juin 2016

TypeError: 'int' object is not subscriptable

So basically I have to tell the user if the staff working in a phone shop has earned a bonus. If the staff sold more than 4 or more phones, they get a bonus.

Problem is I keep getting this error.

    if  list[member_number]>=4:
TypeError: 'int' object is not subscriptable

This is my code-

How_Many_Members= int(input("Enter the number of staff members:"))

list=[]
member=1

while len(list)!= How_Many_Members:

    print("how many phones did the member", member,"sold?",end=" ")

    Sales=int(input(""))
    list.append(Sales)
    member=member+1


member_number=0

for list in range(0,How_Many_Members,1):
    if  list[member_number]>=4:
        print("member",memeber_number,"has earned a bonus")
        member_number=member_number+1
    else:
        print("member",memeber_number,"has not earned a bonus")
        member_number=member_number+1

Aucun commentaire:

Enregistrer un commentaire