Home > other >  Shanghai Python textbooks on the suspected error
Shanghai Python textbooks on the suspected error

Time:01-16

Today to review the information technology level examination in colleges and universities in Shanghai secondary reference materials "Python program design basis" to find a textbook example code wrong (the following figure x [' a ']. Append (5)), on the idle test error, want to know what is right or wrong books I test

CodePudding user response:

Should be x [' b ']. Append (5)

CodePudding user response:

Certainly wrong, x [' a '] as a result of the integer 1, how can use append to add elements to 5?

CodePudding user response:


X={' a ': [1],' b ': {2 and 4}}
X [' a ']. Append (5)

print(x)
  • Related