When you write to a file, what happens to the content that’s already there? A.The new content replaces the original content. B.The new content goes at the end. C.It depends how you open the file.
What string does the following produce: “a %d b %d” % (1,2) A.“a 1 b 2 d” B.“a b d 1 2” C.(results in error) D.“a %d b %d % (1,2)”
“a %d” % 1 The first % above (before the d) is called a “conversion specification,” which means that it explains how the 1 on the right should be “converted” when placing it in the string. How does Python know that this first above % does not mean modulo (remainder)? A.It comes before a d B.It is part of a string C.It is in a line with two % signs D.The python knows all and sees all
“a %d” % 1 The second % above (before the 1) is called a “formatting operator”, and indicates that the 1 should be appropriately inserted into the “format string” on the left. How does Python know that the second % means this, and not modulo (remainder)? A.The number to the right matches the conversion specifications in the string on the left B.It has a string to the left of it C.It is in a line with two % signs D.The python knows all and sees all