ANSWERS COMPLETED 2025.
, WGU C859 PYTHON EXAM 50+ QUESTIONS AND
ANSWERS COMPLETED 2025.
f1 = open("/my_path/my_file.text", "r") ---- ANSWER>>>to open and read a
file
f1 = open("/my_path/my_file.text", "w") ---- ANSWER>>>to open and write
a file (all previous material discarded)
f1 = open("/my_path/my_file.text", "a") ---- ANSWER>>>to open and add to
a file
f1.read() ---- ANSWER>>>read a file into a string
f1.write("hello!") ----ANSWER>>>writes to a file
f1.readline() -----ANSWER>>>reads next line
f1.close() ---- ANSWER>>>closes a file (must always close a file!)
with open("/my_file...etc) as f: ---- ANSWER>>>opens, allows work, and
automatically closes a file
timedelta ----ANSWER>>>time library function to calculate time amounts
from datetime import timedelta ----ANSWER>>>grabs timedelta from the
datetime library
import datetime as dt ---- ANSWER>>>imports a library as a specified
variable