WGU D335 Introduction to Programming in
Python OBJECTIVE
ASSESSMENT|2025\2026
Score 76/ 76
100%
1. Which of the following code snippets correctly demonstrates the use of the
decimal module to avoid floating-point precision errors when adding two
decimal numbers?
from decimal import Decimal
num1 = Decimal('0.1')
num2 = Decimal('0.2')
result = num1 + num2
print(result)
num1 = 0.1
num2 = 0.2
result = num1 + num2
print(f'Sum: {result}')
from decimal import Decimal
num1 = 0.1
num2 = 0.2
result = Decimal(num1) + Decimal(num2)
print(f'Sum: {result}')
from decimal import Decimal
num1 = Decimal('0.1')
num2 = Decimal('0.2')
1/23
,29/11/2025, 07:06 Introduction to Python Programming - results
result = num1 * num2
print(f'Accurate product using decimal: {result}')
2. The arithmetic operators used in mathematical expressions are as follows:
_____.
addition uses &, subtraction uses $, multiplication uses #, division uses
/, and modulo division uses !
2/23
, 29/11/2025, 07:06 Introduction to Python Programming - results
addition uses @, subtraction uses -, multiplication uses *, division uses
\, and modulo division uses %
addition uses +, subtraction uses -, multiplication uses *, division
uses /, and modulo division uses %
addition uses &, subtraction uses -, multiplication uses #, division uses
/, and modulo division uses \
3. What does "slicing" mean in Python?
Extracting a portion of a list, tuple, or string
Removing the first element of a list
Sorting a list in reverse order
Combining two lists into one
4. Which of the following lines of code will print the elements at indices 2, 3,
and 4 from the my_list list?
print (my_list[2:3] )
print (my_list(2:5) )
print (my_list[2:5] )
print (my_list.slice(2, 3) )
5. What is the primary purpose of the pickle module in Python?
To convert Python objects into a byte stream for storage or
transmission
To perform mathematical operations on data
To manage file input and output operations
To create graphical user interfaces
3/23