WGU D522 (Python) comprehensive
Questions and Answers with Verified
Solutions
Question 1:
What does read() do?
Answer:
Reads data from a file
Question 2:
What does input() do?
Answer:
gets user input from the console/terminal. Returns what's typed as a
string
Question 3:
What does write() do?
Answer:
Writes data to a file
Question 4:
What is 'w' mode?
Answer:
Write
, Question 5:
What is 'a' mode?
Answer:
Append
Question 6:
What does print() do?
Answer:
Displays output to the console/screen. Mainly used for seeing what code
is doing or debugging.
Question 7:
What should be at the end of a functions definition? Colon
Answer:
Question 8:
What data structure do the brackets indicate in the following example?
devices = ["router01", "switch01", "modem01", "gateway01", "printer01"]
Answer:
A List
Question 9:
What data structure do the brackets indicate in the following example?
devices = ("router01", "switch01", "modem01", "gateway01", "printer01")
Answer:
A Tuple
Questions and Answers with Verified
Solutions
Question 1:
What does read() do?
Answer:
Reads data from a file
Question 2:
What does input() do?
Answer:
gets user input from the console/terminal. Returns what's typed as a
string
Question 3:
What does write() do?
Answer:
Writes data to a file
Question 4:
What is 'w' mode?
Answer:
Write
, Question 5:
What is 'a' mode?
Answer:
Append
Question 6:
What does print() do?
Answer:
Displays output to the console/screen. Mainly used for seeing what code
is doing or debugging.
Question 7:
What should be at the end of a functions definition? Colon
Answer:
Question 8:
What data structure do the brackets indicate in the following example?
devices = ["router01", "switch01", "modem01", "gateway01", "printer01"]
Answer:
A List
Question 9:
What data structure do the brackets indicate in the following example?
devices = ("router01", "switch01", "modem01", "gateway01", "printer01")
Answer:
A Tuple