OA
WGU D335 Intro to Python | OA | Objective Assessment | 15
Actual Questions and Answers | 2025 Update | 100% Correct.
Correct 15
Incorrect
WGU D335
15 Correct terms
Questions and answers
1 of 15
Term
Create a solution that accepts an integer input representing the age
of a pig. Import the existing module pigAge and use its pre-built
pigAge_converter() function to calculate the human equivalent age
of a pig. A year in a pig's life is equivalent to five years in a human's
life. Output the human-equivalent age of the pig.
Give this one a go later!
,5/16/25, 10:40 PM WGU D335 Introduction to python
OA
import csv
input1 = input()
with open(input1, "r") as f:
data = [row for row in csv.reader(f)]
for row in data:
even = [row[i].strip() for i in range(0, len(row), 2)]
odd = [row[i].strip() for i in range(1, len(row), 2)]
pair = dict(zip(even, odd))
print(pair)
import pigAge
def pigAge_converter(pig_age):
return pig_age * 5
pig_age = int(input())
converted_pig_age = pigAge_converter(pig_age)
print(f'{pig_age} is {converted_pig_age} in human years')
student_id = int(input())
student_id_string = str(student_id)
first3 = student_id_string[0:3]
second2 = student_id_string[3:5]
third4 = student_id_string[5:]
print(f'{first3}-{second2}-{third4}')
import math
fact = int(input())
x = math.factorial(fact)
print(x)
if x > 100:
print('True')
else:
print('False')
Don't know?
2 of 15
, 5/16/25, 10:40 PM WGU D335 Introduction to python
OA
Definition
index_value = int(input())
try:
if index_value == 0:
print(frameworks[0])
if index_value == 1:
print(frameworks[1])
if index_value == 2:
print(frameworks[2])
if index_value == 3:
print(frameworks[3])
if index_value == 4:
print(frameworks[4])
if index_value == 5:
print(frameworks[5])
if index_value > 5:
print(frameworks[index_value])
except:
print('Error')
Give this one a go later!
Create a solution that accepts one integer input representing the index
value for any of the string elements in the following list:
frameworks = ["Django", "Flask", "CherryPy", "Bottle", "Web2Py",
"TurboGears"]
Output the string element of the index value entered. The solution should
be placed in a try block and implement an exception of "Error" if an incom
mypatible integer input is provided
Create a solution that accepts an input identifying the name of a text file, for
example, "WordTextFile1.txt". Each text file contains three rows with one word per
row. Using the open() function and write() and read() methods, interact with the