WGU E010 Objective Assessment Final
Exam Questions And Answers Practice Questions
with Solutions Newest 2026-2027 | Already
Graded A+
Write a complete function calculate_discount(price,
discount_percent) that calculates and returns the final price after
applying a discount percentage.
For example, calculate_discount(75, 20) should return 60.0.
def calculate_discount(price, discount_percent):
# TODO: Calculate and return the final price after discount
pass - ANSWER-def calculate_discount(price,
discount_percent):
return price * (1 - discount_percent / 100)
,2|Page
Write a complete function password_strength(password) that
returns "Strong" if the password is at least 8 characters long and
contains both letters and numbers, "Weak" otherwise.
For example, password_strength("abc123def") should return
"Strong".
def password_strength(password):
# TODO: Return "Strong" or "Weak" based on password
criteria
if len(password) < 8:
return "Weak"
has_letter = False
has_number = False
for char in password:
if char.isalpha():
has_letter = True
elif char.isdigit():
has_number = True
, 3|Page
# TODO: Add your return logic here based on has_letter and
has_number
pass - ANSWER-def password_strength(password):
if len(password) < 8:
return "Weak"
has_letter = False
has_number = False
for char in password:
if char.isalpha():
has_letter = True
elif char.isdigit():
has_number = True
if has_letter and has_number:
return "Strong"
else:
return "Weak"