Skip to content

Commit af9104e

Browse files
authored
Update compliant02.py
Added new compliant02.py Signed-off-by: BartyBoi1128 <[email protected]>
1 parent c066c3f commit af9104e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# SPDX-FileCopyrightText: OpenSSF project contributors
22
# SPDX-License-Identifier: MIT
3+
""" Compliant Code Example """
34
from decimal import Decimal
4-
5-
balance = Decimal("3.00")
6-
item_cost = Decimal("0.33")
7-
item_count = 5
8-
9-
#####################
10-
# exploiting above code example
11-
#####################
5+
BALANCE = Decimal("3.00")
6+
ITEM_COST = Decimal("0.33")
7+
ITEM_COUNT = 5
8+
129
print(
13-
f"{str(item_count)} items bought, ${item_cost} each. "
14-
f"Current account balance: ${str(balance - item_count * item_cost)}"
10+
f"{str(ITEM_COUNT)} items bought, ${ITEM_COST} each. "
11+
f"Current account balance: "
12+
F"${str(BALANCE - ITEM_COUNT * ITEM_COST)}"
1513
)

0 commit comments

Comments
 (0)