Issue
Can I, for example, copy this number from one file to another?
inp = int(input("Enter your number:"))
I want to copy the inp to another file and I want to use the number in the other file ,like this
another file:
print("", inp)
Can I do this and thank you.
Solution
You could write it in a function, then import that function in the other file.
input.py
def input_number():
inp = int(input("Enter your number"))
return inp
Other file:
from input import input_number
inp = input_number()
print("", inp)
Answered By - Liam Welsh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.