Skip to content

Commit 9ab3ff0

Browse files
committed
Qiskit coding skills for Bell States and Deutsch algorithm
Signed-off-by: lzrvc <[email protected]>
1 parent da81c29 commit 9ab3ff0

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Title of work: Basic quantum gates - Bell and Deutsch oracles
2+
License of the work: MIT
3+
Creator names: Sasha Lazarevic
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
created_by: lzrvc-ibm
2+
version: 3
3+
task_description: >-
4+
This is code that will teach the student model on how to code Bell states and
5+
Deutsch algorithm
6+
seed_examples:
7+
- question: give me the Qiskit code for the qubit gates for the first Bell state
8+
answer: |-
9+
qc.h(q[0])
10+
qc.cx(q[0],q[1])
11+
- question: give me the Qiskit code for the qubit gates for the second Bell state
12+
answer: |-
13+
qc.h(q[0])
14+
qc.cx(q[0],q[1])
15+
qc.z(q[0])
16+
- question: give me the Qiskit code for the qubit gates for the third Bell state
17+
answer: |-
18+
qc.h(q[0])
19+
qc.cx(q[0],q[1])
20+
qc.x(q[1])
21+
- question: give me the Qiskit code for the qubit gates for the fourth Bell state
22+
answer: |-
23+
qc.h(q[0])
24+
qc.cx(q[0],q[1])
25+
qc.z(q[0])
26+
qc.x(q[1])
27+
- question: >-
28+
give me the Qiskit code for the qubit gates for the implementation of
29+
oracle function for Deutsch algorithm
30+
answer: |-
31+
def blackbox(oracleType=None):
32+
33+
if oracleType == None:
34+
oracleType = np.random.randint(4)
35+
36+
oracles = {0: 'qc.iden(q[1])', 1: 'qc.x(q[1])', 2: 'qc.cx(q[0], q[1])', 3: 'qc.cx(q[0], q[1]), qc.x(q[1])'}
37+
return oracles[oracleType]

0 commit comments

Comments
 (0)