Docsity

WGU C859 PYTHON TEST 2023 -2024 UPDATE WITH COMPLETE SOLUTION, Exams of Information Integration

Toggle sidebar
bg1
WGU C859 PYTHON TEST 2023 -2024 UPDATE WITH
COMPLETE SOLUTION
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
datetime.date.today().month - ANSWER- to print current month (aka .day or .year for those)
pf3
pf4
pf5

Partial preview of the text

Download WGU C859 PYTHON TEST 2023 -2024 UPDATE WITH COMPLETE SOLUTION and more Exams Information Integration in PDF only on Docsity!

WGU C859 PYTHON TEST 2023 - 2024 UPDATE WITH

COMPLETE SOLUTION

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 datetime.date.today().month - ANSWER- to print current month (aka .day or .year for those)

beautiful soup - ANSWER- HTML parsing library NumPy - ANSWER- scientific computing, matrices, array creation library pandas - ANSWER- data manipulation and analysis library pillow (PIL) - ANSWER- work with and manipulate images; python imaging library pyglet - ANSWER- multimedia / gaming creation library pytz - ANSWER- time zone data library pip install ____________ import _______________ - ANSWER- to install and import a library into your code math.ceil() - ANSWER- round down (4.5 = 4, 4.8 = 4, 4.1 = 4, 4.9 = 4) math.floor() - ANSWER- round up (4.6 = 5, 4.7 = 5, 4.1 = 5, 4.2 = 5) datetime.date.today() - ANSWER- get today's date datetime.date.(1967, 9, 7) print(mybday.strftime("%A")) - ANSWER- gets the day of the week math.factorial() - ANSWER- multiplies each number in argument to give answer math.exp() - ANSWER- return e raised to power of (x) (natural log) math.sqrt() - ANSWER- return square root of x

pandas.describe() - ANSWER- generates descriptive statistics, stats summary pandas.series() - ANSWER- dataframe; 2 dimensional labeled data structure slicing (with 9 elements, grabbing the first 3) - ANSWER- my_list[:3] upper bound is exclusive slicing(with 9 elements, grabbing the last 3) - ANSWER- my_list[6:] lower bound is inclusive slicing(with 9 elements, grabbing middle 3) - ANSWER- my_list[3:6] mylist.count() - ANSWER- counts how many times that item appears mylist.remove() - ANSWER- removes item in a list; example - (0) removes 1st element mylist.reverse() - ANSWER- reverses the items in a list mylist.pop() - ANSWER- removes last item in list mylist.pop(3) - ANSWER- removes 4th item in list mylist.index(str or int) - ANSWER- finds that specific item in list and returns it's index myset.pop() - ANSWER- removes a random element since set are not in any specific order tuple syntax - ANSWER- dimensions = 50, 40, 20 formating - ANSWER- print("The ages are {}, {}, and {}.".format(age1, age2, age3))

syntax to add element to a set - ANSWER- myset.add("item") syntax to add element to the end of a list - ANSWER- mylist.append("item") syntax to add element to a specific spot in a list - ANSWER- mylist.insert(index, "item") syntax to create a dictionary - ANSWER- mydictionary = {"Elise": 67, "Carlos":66, "Jacquie":92} syntax to get a specific value in a dictionary - ANSWER- mydictionary.get("Elise) will return 67 or print(mydictionary["Elise"] will print 67