Can someone please help nothing I do seems to work out was wondering if you guys had any knowledge about this I also left a link below so you guys could get a better understanding on my situation i've tried almost everything and nothing seems to work. [1]: https://i.stack.imgur.com/vFYep.jpg
Asked
Active
Viewed 123 times
0
-
Welcome to Stack Overflow. [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied, or even consumed by users of adaptive technologies like screen readers. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike May 22 '22 at 13:33
2 Answers
0
In your image you have from qiskit.providers,aer import AerSimulator
that comma between providers and aer should be a period i.e from qiskit.providers.aer import AerSimulator
Plus the lines import modules for Qiskit
and import Qiskit
should be removed. You can see its failing with a syntax error on the first of these lines as its invalid syntax too with for
in there. I assume the specific imports below those lines are all you need.

Steve Wood
- 266
- 1
- 3
-
should I remove it and replace the comer with a full stop is that all and thank you for the help I really appreciate it. – keenen oliver May 22 '22 at 17:14
-
The first two lines need removing, yes. The first is incorrect syntax, and what the error message is telling you in the image. The second is correct syntax but there is no package Qiskit (with the uppercase Q). If you wanted to do that it would be 'import qiskit' in lowercase. If you had that then you would do something like 'qc = qiskit.QuantumCircuit()' But given the list of imports, that bring all those in directly, I guessed it would not be needed. So I would remove those first two lines and fix up the , to . in the last one and see what happens with the rest of the code. – Steve Wood May 22 '22 at 21:21
-
o.write('IBM node:' + qpu_name) i get a IdentationError: expected an indented block??? Any Idea on what I can do Google not very helpful I really Appreciate it. – keenen oliver May 23 '22 at 09:49
-
I ran into a few Problems and I need your help could I drop some pics and maybe you could have a look at them? – keenen oliver May 23 '22 at 10:54
-
It seems like you are struggling with basic Python syntax. Maybe lookup a tutorial on Python. For indentation Python does blocks based on indenting which needs to be consistent - use tabs or spaces and the same number for indenting. So inside an `if` block, a `for` or defining a method etc make sure the lines you want to be part of the if etc are indented to the same level. – Steve Wood May 23 '22 at 19:22
-
For images the comment to your original post above is asking not to post images here - the links has numerous reasons why not. Copy/paste the code and error messages etc here. – Steve Wood May 23 '22 at 19:24
-
No problem. 1. o.write('IBM node:'+ qpu_name), right it then tells me IndentationError:expected an indented block.2. hashIn_bin = bin(int(hashIn, scale))[2:].zfill(len(hashIn)*4) NameError:Name hasIn is not defined, aswell with exp_quantum_operation. 3. total_time = str((time.time() - start)) IndentationError: unindent does not match any outer indentation level.? 4.four_bits = hashIn_bin[2+4*i:2+4*i+4] IndentationError: expected an indented block. There's to much post I need urgent help. – keenen oliver May 24 '22 at 08:15
-
I cannot tell anything from the above. The comment under your original question has a link where it has instructions on how to post the code instead of images. Maybe edit your orignal question to include the code as it did not format there in comments and the format, that includes indents, which Python uses to delimit blocks, did not come out. As to `hasin` is not defined - you need to have set a variable like `hasin = qc.calc(x)` or maybe its a spelling error as it has to match one that is defined. – Steve Wood May 24 '22 at 11:30
0
I'll redo everything from over and see what all I can tackle by myself and then let you know.
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 29 '22 at 05:09