Skip to content
C

Problem 2: Manually Calculate TP, TN, FP, FN

Easypython

Problem Description

Write a Python program that manually counts True Positives, True Negatives, False Positives, and False Negatives given actual and predicted labels, without using any built-in function.

Input

Two lists: actual labels and predicted labels.

Output

The counts of TP, TN, FP, and FN.

Constraints

  • Both lists have the same length, containing binary values.

Example Input

text
actual=[1,0,1,1,0], predicted=[1,0,0,1,0]

Example Output

text
TP: 2, TN: 2, FP: 0, FN: 1

Concepts Covered

Loops, conditionals, manual counting.

Input (stdin)

Output

Run your code to see output here...