Python module questions

Asked 1 years ago, Updated 1 years ago, 114 views

For example,

from math import factorial def factorial(n): return factorial(n)

There is a Python file called as above.

from file1 import factorial

a = input("n : ") print (factorial(a))

Suppose you have a file called file2.py.

I'd like to send the n value input from file2 to file1, is there any way?

python module import

2022-09-22 19:34

1 Answers

It means from, so you can write that value. I don't know because I'm not looking at the whole code, but I can't load a function without n. If n is not in the function, you can do from file2 import *.


2022-09-22 19:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.