ACTUAL EXAM AND PRACTICE QUESTIONS
AND SOLUTIONS| CURRENTLY TESTING
VERSION | ALREADY GRADED A+|EXPERT
VERIFIED FOR GUARANTEED PASS 2026-2027
Complete the function double_number(num) that takes one number parameter and
returns double that number.
For example, double_number(5) should return 10.
def double_number(num):
# TODO: Return double the input number
# Example: double_number(5) should return 10
pass
def double_number(num):
return num * 2
Modify the function greet_with_default(name) by adding a default value of "World" to the
name parameter so it can be called with or without an argument.
def greet_with_default(name):
# TODO: Add a default value of "World" to the name parameter
return "Hello " + name
def greet_with_default(name="World"):
return "Hello " + name
1|Page
, Complete the function is_positive(number) that returns True if the number is greater than 0,
and False otherwise.
def is_positive(number):
# TODO: Return True if number > 0, False otherwise
pass
def is_positive(number):
return number > 0
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
def calculate_discount(price, discount_percent):
return price * (1 - discount_percent / 100)
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"
2|Page