# Problem 4: Find the Number of Ground States for a Two-Qubit System • According your DWave API this is the outcome:

x0 = 1 |  x1 = 0 | Energy = -0.200000 | Probability = 41.300000 %
x0 = 0 | x1 = 1 | Energy = -0.200000 | Probability = 58.700000 %

Here is the code:

https://github.com/CalogeroZarbo/quantum_training/blob/master/dwave_problem4.py

@Edit: PS Thanks and Credits to Yasas for the DWave Problem3 code kindly posted that led me into the Python API properly. If the answer is right, I'll split the first place with you mate :)

`# Calogero Zarbo, Docebo, 09-Feb-2019# D-Wave Challenge 4from dwave.system.samplers import DWaveSamplerfrom dwave.system.composites import EmbeddingCompositeimport dimodq01=1q0=-0.2q1=-0.2shots = 1000linear = {1: q0, 2: q1}quadratic = {(1, 2): q01}bqm = dimod.BinaryQuadraticModel(linear, quadratic, 0.0, dimod.BINARY)sampler = EmbeddingComposite(DWaveSampler())response = sampler.sample(bqm, num_reads=shots)for res in response.data(['sample', 'energy', 'num_occurrences']):    print('|x0 = %s |x1 = %s | Energy = %f | Probability  = %f %% ' % (res.sample,res.sample,          res.energy, res.num_occurrences*100/shots))`
• Good job Calogero!

I got the same.

Bonus Answer: This represents a NOT gate.

In the below code, I tried the manual embedding as explained in D-Wave documentation as well as automatic embedding. Each method gave the same results.

For manual embedding, I used q-bits 0 and 1. However, as the unit cell architecture q-bits 0 and 1 does not have a physical coupling link. Then, how does the code work? • Hello Yasas,

I think I can answer your embedding question without spoiling the challenge for others.

I noticed you used EmbeddingComposite in all your methods. EmbeddingComposite actually does the embedding step automatically, so it allows the user to enter qubits and connections that does not necessarily match the structure of the QPU.

It is actually possible to sample the QPU directly with DWaveSampler - in this case your qubits and connectors need to match the QPU's structure.

• Thanks for posting your answers Calogero and Yasas!  You are both correct: the answer is 2 ground states.