Hello people I am new here and I try my best.
I got my first question for this forum and i hope for good comunication.
So here we go:

I want to create a Fibonacci-Generator like:

from fibonacci import fib

now the problem is i have this:;
fibonacci def

i want to create the fibonacci data but if i write it in a normal data or .txt it wont work.

Here you go guys i hope u can help me i am at the start of python and keep goin!

Thanks for the answers.

What does “won’t work” mean for you? Does the computer crash and you have to restart? Do you get an exception traceback? Something else happens?

Please don’t post screenshots of text. If you want to post code, copy and paste the code as text.

We don’t use Photoshop to write programs, having code as a picture is useless and discriminates against the blind. Yes, blind programmers exist.

Paste your code within “code fences” so that the indentation is kept:

code goes here

Note that the three backticks have to go on their own line.

The same applies to tracebacks. If you get a traceback, copy and paste the entire error from the first line “Traceback …” to the last.

1 Like

Ok thanks first of all for telling me some rules and I am sorry for the screenshot I will explain my problem.
All i do right now is learning and posting my questions if i dont find any answer myself.

Now here is the Fibonacci-Generator:

def fib(max):
      a, b = 0, 1
      while a < max:
            yield a
            a, b = b, a + b

Now my problem is that i see no solution for my question, in what kind of data i need to put it in.
(sorry for my bad english)

My problem:

from fibonacci import fib
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from fibonacci import fib
ModuleNotFoundError: No module named 'fibonacci'

So i understand that i have no module named fibonacci but is there some kind of import? I dont really get it.

Where is your Fibinacci generator function saved?

If you want to use it in the same file, you don’t need to import it because it is already there.

Have you done a Python tutorial? That might help.