For example,
from math import factorial def factorial(n): return factorial(n)
There is a Python file called
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
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 *.
© 2024 OneMinuteCode. All rights reserved.