import addmodule

a = 10
b = 20
c = addmodule.add(a, b)
print(c)
Exemplo n.º 2
0
import addmodule
print(addmodule.add(5,4))
Exemplo n.º 3
0
import addmodule
print(addmodule.msg)
print(addmodule.add(10, 20))

line = '-' * 40
print(line)

import sys
print(sys.path)
#sys.path.append(r'C:\pythontraining\lib')
print(line)

import addmodule as a
print(a.msg)
print(a.add(10, 20))
print(line)

from addmodule import msg, add
print(msg)
print(add(10, 20))
print(line)

from addmodule import msg as m, add as a
print(m)
print(a(10, 20))
print(line)

from addmodule import *
print(msg)
print(add(10, 20))
print(line)
#main_prog.py import the function from lib folder

import addmodule  #defined function in lib
import sys
r1 = sys.path
print('r1=', r1)

sys.path.append(
    r'..\lib'
)  #second way to add path vriable but temporary only till program execution
r2 = sys.path
print('r2 =', r2)

print(addmodule.msg)
print(addmodule.add(10, 20))

import addmodule as a

print(a.msg)
print(a.add(10, 20))

from addmodule import msg, add
print(msg)
print(add(10, 20))

from addmodule import *
print(msg)
print(add(10, 20))

from addmodule import msg as m
print(m)
Exemplo n.º 5
0
import addmodule as ad
a = int(input("enter the first number"))
b = int(input("enter the second number"))
print(ad.add(a, b))
Exemplo n.º 6
0
import addmodule
print(addmodule.add(10, 20))
print(addmodule.msg)
#Two ways to add module. First is setting the env variale. Env VAr Name='PYTHONPATH' value: Path of lib
#Second Way
import sys
print(sys.path)
#sys.path.append(r'C:\Users\lab365\Desktop\PythonTraining\lib')

import addmodule as a
print(a.msg)
print(a.add(10, 20))

from addmodule import msg, add
print(add(10, 20))
print(msg)

from addmodule import msg as m, add as a
print(m)
print(a(10, 20))

from addmodule import *
print(msg)
print(add(20, 30))

import Project.net.addmodule
print(Project.net.addmodule.msg)

import Project.net.addmodule as a
print(a.msg)
Exemplo n.º 7
0
import addmodule as addm
a = int(input("enter  number"))
b = int(input("enter another number"))
print(addm.add(a, b))
Exemplo n.º 8
0
import addmodule

print(addmodule.msg)
print(addmodule.add(45, 10))
line = '-' * 40
print(line)

# 2nd way to add path using program to do this we use a std library named sys
import sys

print(sys.path)
# sys.path.append(r'C:\Users\lab365\Desktop\Python Training\lib')

import addmodule as a

print(a.msg)
print(a.add(10, 20))
print(line)

from addmodule import msg, add

print(msg)
print(add(10, 29))
print(line)

from addmodule import msg as m, add as a

print(m)
print(a(10, 20))
print(line)