From 1fa8245017fcf065bc6b7854eaf8c999db0eaa35 Mon Sep 17 00:00:00 2001 From: Devansh Trivedi Date: Tue, 3 May 2022 15:28:46 +0530 Subject: [PATCH] Fixed IndexError list index out of range for printing results from the sample set Signed-off-by: Devansh Trivedi --- npp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npp.py b/npp.py index d3771c1..5a50a1e 100644 --- a/npp.py +++ b/npp.py @@ -70,6 +70,6 @@ def run_on_qpu(Q, sampler): ## ------- Return results to user ------- for sample in sample_set: - S1 = [S[i] for i in sample if sample[i] == 1] - S0 = [S[i] for i in sample if sample[i] == 0] + S1 = [S[i] for i in range(1,8) if sample[i] == 1] + S0 = [S[i] for i in range(1,8) if sample[i] == 0] print("S0 Sum: ", sum(S0), "\tS1 Sum: ", sum(S1), "\t", S0)