Skip to content

Commit 065c729

Browse files
Create 2011. Final Value of Variable After Performing Operations.py
1 parent 5eab29f commit 065c729

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def finalValueAfterOperations(self, operations: List[str]) -> int:
3+
addition_one = operations.count('X++')
4+
addition_two = operations.count('++X')
5+
subtraction_one = operations.count('X--')
6+
subtraction_two = operations.count('--X')
7+
final_value = addition_one + addition_two - subtraction_one - subtraction_two
8+
return final_value

0 commit comments

Comments
 (0)