Chyba Pythonu TypeError: objekt „set“ nie je možné zapísať

Python Error Typeerror



Vo fáze učenia Pthyon, keď iteroval výstupný zoznam, bol vytvorený objekt kolekcie a objavil sa tento BUG (pri vytváraní objektu write () as ())
Nasledujú chybové prípady:

#Created collection names = {'Your uncle','Your Second Uncle','Your Big Three'} ages = {18,19,20,21} jobs = {'teacher','programmer','Soy Sauce'} for i in range(3): print('Name: {0}, age: {1}, work: {2}'.format(names[i],ages[i],jobs[i])) #TypeError: 'set' object is not subscriptable # Indicates that the collection object without subscript operation is used as an object[i]

Toto je správny prípad:



names1 = ('Your uncle','Your Second Uncle','Your Big Three') ages1 = (18,19,20,21) jobs1 = ('teacher','programmer','Soy Sauce') for i in range(3): print('Name: {0}, age: {1}, work: {2}'.format(names1[i],ages1[i],jobs1[i]))

Nováčik, prosím o radu ~