예제 #1
0
import module1
a = int(input("Enter the 1st value"))
b = int(input("Enter the 2nd value"))
ch = input("Enter the operator from +,-,/,*")

if ch == '+':
    print(module1.sum(a, b))

elif ch == '-':
    print(module1.sub(a, b))

elif ch == '/':
    print(module1.div(a, b))

elif ch == '*':
    print(module1.mul(a, b))

else:
    print("Invalid operator")
예제 #2
0
import module1 as m
# from module1 import sum

print(m.sum(10, 28))
print(m.mul(4, 9))
예제 #3
0
#Approach1
import module1

module1.add(10,20)
module1.mul(10,20)

#Approach2
from module1 import add,mul     #if we dont want to use module name each time while calling a function

add(10,20)
mul(10,20)

#Approach3
from module1 import *       #When we have too many numbers of functions in a module and we want to import all functions

add(10,20)
mul(10,20)
예제 #4
0
import module1 as mod1
from module1 import sub
import random

print(sub(6, 7))

addval = mod1.add(1, 3)
print("addition of two number: " + str(addval))

subVal = mod1.sub(6, 9)
print("subtraction of two number : " + str(subVal))

mulVal = mod1.mul(8, 5)
print("Multiplication of two number : " + str(mulVal))

# print("factorial of a number " + str(mod1.fact(20)))

print("factorial of a number " + str(mod1.factorial(6)))

print(random.randrange(0, 50))
예제 #5
0
print(module2.add(3,4))#7

print(module2.div(12,3))#144.0

print(module3.div(12,3))#4.0


print(name)#python
"""
###1st method loading files
import module1
print(module1.a)
print(module1.b)
print(module1.add(4, 5))
print(module1.sub(4, 5))
print(module1.mul(4, 5))
###2nd method
from module1 import *
print(a)
print(b)
print(add(4, 5))
print(sub(4, 5))
print(mul(4, 5))

import sys
print(sys.path)
sys.path.append('C:/Users/Vali Basha/Desktop/11morning')
print(sys.path)

from module1 import (add, sub)
print(add(4, 5))