Lesson 23 – Function Order & Calculation Practice

Program Structure in World of Software Engineering

In World of Software Engineering, bosses sometimes apply a damage boost effect.

For example, a boss could do extra damage by 15% on their spell, that means the new damage is slightly larger than the original value.
Let’s break that down carefully.

15% means 15 out of 100.

In programming, percentages are easier to work with as decimals.

To convert a percentage to a decimal:
Divide it by 100.

15 ÷ 100 = 0.15
Now think about what “increase by 15%” really means.

It does NOT mean multiply by 0.15.

That would only give you the extra amount.

Instead, we want:

Original amount + 15% of original amount
There is a shortcut for this.

Instead of writing:

base_damage + (base_damage × 0.15)

We can combine it into one step:

base_damage × 1.15

Why 1.15?

Because 1 represents 100% (the original value).
0.15 represents the 15% increase.

1 + 0.15 = 1.15
So if base_damage was 250:

250 × 1.15 = 287.5

That is the new scaled damage.
Your Task:

Write the function so it:

1. Takes in the base damage as a parameter
2. Multiplies it by a scale
3. Returns the result

Remember:
We use return when we want the function to give a value back.
Your Challenge:

The dungeon boss Hakkar spits a poison effect on a player that gets stronger over time (called a damage over time spell) to a player.

The damage increases by 12% each tick.

Write a function called scale_damage that returns the increased damage amount.
Complete the scaling function
def scale_damage(base_damage):
    return ?
    

# Don't touch below this comment

def main():
    damage = 250
    new_damage = scale_damage(damage)
    print("Scaled damage:", round(new_damage, 2))

main()