Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question # 3 multiple select which of these statements are true? select…

Question

question # 3
multiple select
which of these statements are true? select 2 options.
the new line character is \\
ewline\.
python can only be used with files having \.py\ as an extension.
if you open a file in append mode, the program halts with an error if the file named does not exist.
in a single program, you can read from one file and write to another.
if you open a file in append mode, python creates a new file if the file named does not exist.

Explanation:

Brief Explanations
  1. The new - line character in Python is '

', not '
ewline', so the first option is false.

  1. Python code can be run in interactive mode or in files with other extensions (e.g., in Jupyter notebooks with.ipynb), not only with.py extension, so the second option is false.
  2. When opening a file in append mode ('a') in Python, if the file does not exist, Python creates a new file instead of halting with an error, so the third option is false.
  3. In Python, it is common to read from one file and write to another in a single program, for example, when processing data from a source file and saving the results to a new file. This option is true.
  4. When opening a file in append mode in Python, if the file does not exist, a new file is created. This option is true.

Answer:

D. In a single program, you can read from one file and write to another.
E. If you open a file in append mode, Python creates a new file if the file named does not exist.