import mymath as mym  ## import module mymath.py created

x = 10
y = 15

print('Sum of %0.1f + %0.1f = %0.1f' % (x, y, mym.add(x, y)))
print('Diff of %0.1f - %0.1f = %0.1f' % (x, y, mym.diff(x, y)))
Пример #2
0
import mymath as ma

print(ma.sum(7, 8))

print(ma.diff(7, 8))
Пример #3
0
import mymath

print(mymath.sum(2, 3))
print(mymath.diff(5, 1))
Пример #4
0
import mymath   #imported from mymath created by me inside the project file so that i can use it in the python files
                #<from mymath import *> Thus by using this we can import all the modules from mymath
print(mymath.sum(10,20))   #after we use above syntax to import all modules we can simply use <print(sum(10,20))> instead
print(mymath.diff(10,5))   #and here we can use <print(diff(10,20))>

#we can also modify the name of imported file by using syntax <import mymath as da> here da is of ur choice
#now instead of using mymath evrywhere we can use its modified name i.e. da
Пример #5
0
import mymath as ma

print(ma.add(5, 9))
print(ma.diff(20, 9))
print(ma.mul(5, 5))
print(ma.divi(9, 3))
print(ma.pow(3, 5))
print(ma.modu(9, 2))
print(ma.diff(99, 22))
Пример #6
0
import mymath as ma # from mymath.py

print(ma.sum(10,5))
print(ma.diff(10,5))

'''
OR

from mymath import *
print(sum(10,5))
print(diff(10,5))
'''
Пример #7
0
import mymath

print(mymath.sum(10, 5))
print(mymath.diff(10, 5))

import mymath as ma

print(ma.sum(10, 5))
print(ma.diff(10, 5))

from mymath import *

print(sum(10, 5))
print(diff(10, 5))
Пример #8
0
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 16 15:43:48 2020

@author: spiridiv
"""

import mymath

#module could be omported as alias as well
#import mymath as ma

print(mymath.sum(5, 10))
print(mymath.diff(10, 9))

#Or if want to import all only some of the functions inside the modules
# from mymath import *
# OR
# from mymath import sum - to import sum only
Пример #9
0
from mymath import *
import mymath as ma
import mymath

print(mymath.sum(20, 10))
print(mymath.diff(20, 10))
print(mymath.mult(20, 10))
print(mymath.divi(20, 10))

# Creating a alias name to import so that no need to always type mymath while
# envoke mymath.function_name everytime.
print(ma.sum(20, 10))

# If we ever feel to exclude the module name, and just envoke the function by
# its name, then :
print(sum(10, 20))
Пример #10
0
import mymath

print(mymath.sum(7, 8))

print(mymath.diff(7, 8))
'''By Ankush Chavan'''
Пример #11
0
import mymath

print(mymath.sum(5, 10))
print(mymath.diff(10, 3))