##        this list of conditions and the following disclaimer.                           ##
##	2.Redistributions in binary form must reproduce the above copyright notice, this  ##
##        list of conditions and the following disclaimer in the documentation and/or     ##
##        other materials provided with the distribution.                                 ##
##                                                                                        ##
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND ANY EXPRESS       ##
## OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF        ##
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ##
## THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,    ##
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF     ##
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ##
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,  ##
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  ##
## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           ##
############################################################################################
if __name__ == '__main__':
	X = 1
	print X
	import module
	Y=module.add(X)
	print Y
	Z=module.extend(Y)
	print Z
	Y=module.together(X,Y,Z)
	print Y
	X=module.double(Y)
	print X

	print module.map( ('X','Y','Z'),X,Y,Z )

Esempio n. 2
0
import math, time, os
import random as r
import module
from module import hi
try:
    import nomodule
except ImportError:
    print('ImportError')

print(math.pi)
print(os.uname())
print(time.time())
print(r.random())

sum = module.add(1, 2)
print(sum)

hi()
Esempio n. 3
0
import module
module.add(10, 30)
Esempio n. 4
0
import module
module.add(8, 8)
x = module.add(8, 8)  #store in variable x
print(x)
y = module.sub(8, 8)
print(y)
z = module.div(10, 2)
print(z)
n = module.mul(10, 10)
print(n)
m = module.floordiv(10, 2)
print(m)
l = module.greater(10, 2)
print(l)
'''import math as factorial
x= 3
print(factorial(x))'''
b = module.sqrt(25)
print(b)
import math as feroz
print(feroz.factorial(30))
print(feroz.sqrt(30))
Esempio n. 5
0
#module

# import module

# fish1 = module.MarketGoods(size=20, price=500)
# fish1.show()

from module import MarketGoods, add

print(add(1, 5))
Esempio n. 6
0
from module import add, sub
a = add(10, 20)
print a
b = sub(10, 20)
print b
def main():
    logging.basicConfig(filename="test.log", level=logging.INFO)
    logging.info("Starting the program.")
    result = module.add(10, 100)
    logging.info("Addition completed.")
Esempio n. 8
0
import module

addres = module.add(100, 200)
subres = module.sub(100, 40)
print(addres)
print(subres)
Esempio n. 9
0
a = summ (23, 56)
pr('Number is', a)

mult = lambda x, y: x * y
print (mult (2,5))

import math

print (math.e)
print (math.pi)
print (math.cos (1))
print (math.sin (2))

import module as m

m.add ("Hi", " World")

m.add (23, 6)

class Car:
    name = "None"
    height = 1000
    speed = 200.00

    def set (self,name,height, speed):
        self.name = name
        self.height = height
        self.speed = speed

        audi = Car ()
        audi.set ("Audi", 1450,320.30)
Esempio n. 10
0
import module

#어떤 모듈 파일에서 import 해서 쓰겟다
#하면 module. 이것 생략 가능
#from module import MarkertGoods , add
#from module import *

fish1 = module.MarkertGoods(size=20, price=500)
fish1.show()

print(module.add(1, 5))
Esempio n. 11
0
import module

print(module.add(45, 65, 12, 88, 99, 33))
print(*module.sort(55, 66, 78, 45, 12, 13))
Esempio n. 12
0
##	1.Redistributions of source code must retain the above copyright notice,          ##
##        this list of conditions and the following disclaimer.                           ##
##	2.Redistributions in binary form must reproduce the above copyright notice, this  ##
##        list of conditions and the following disclaimer in the documentation and/or     ##
##        other materials provided with the distribution.                                 ##
##                                                                                        ##
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND ANY EXPRESS       ##
## OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF        ##
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ##
## THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,    ##
## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF     ##
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ##
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,  ##
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  ##
## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           ##
############################################################################################
if __name__ == '__main__':
    X = 1
    print X
    import module
    Y = module.add(X)
    print Y
    Z = module.extend(Y)
    print Z
    Y = module.together(X, Y, Z)
    print Y
    X = module.double(Y)
    print X

    print module.map(('X', 'Y', 'Z'), X, Y, Z)
Esempio n. 13
0
import module
a = module.add(10, 20)
print a
b = module.sub(10, 20)
print b
Esempio n. 14
0
import sys
#giving system path
sys.path.append("/home/abhishek/Desktop/")
from module import add

print(add(10, 20))
Esempio n. 15
0
import module
a=input("enter first number : ")
b=input("enter second number : ")
sum=module.add(a,b)
great=module.greatest(a,b)
print "sum of two number = ",sum
print "greatest number = ",great

Esempio n. 16
0
import module as mod
x = 10
y = 20
print mod.swap(x, y)
print mod.add(x, y)
print mod.sub(x, y)
print mod.mul(x, y)
print mod.div(x, y)
Esempio n. 17
0
#import module file as md1 or as your wish module as md2 as md1 and md2 is another neme in simple way
#Refer another simple name inside of module or file which you have named
import module as md1
print(md1.add(7, 4))
print(md1.sub(10, 5))
print(md1.div(10, 2))

import module as md2
print(md2.floordiv(10, 2))

import module as sha
print(sha.mul(5, 2))

from module import add, sub, mul, div  # way2 to call function from module file
print(add(7, 4))
print(mul(8, 5))

from math import factorial, sqrt
print(factorial(30))
print(sqrt(30))
Esempio n. 18
0
import module
import random

module.add()
x = random.randrange(1, 100)

print('Random numbere is', x)
Esempio n. 19
0
import module

print(module.add(1))
Esempio n. 20
0
import os
import module

if __name__ == "__main__":

    module.init()
    module.add("samtools")

    os.system("samtools --version")
Esempio n. 21
0
repeat = True
while repeat:
    print()
    print("*" * 100)
    print("\tMenu")
    print("\t 1. Add new Contact")
    print("\t 2. Update Contact")
    print("\t 3. Delete Contact")
    print("\t 4. Search Contact")
    print("\t 5. Show all Contacts")
    print("\t 6. EXIT")
    print("*" * 100)
    choice = int(input("Enter your choice: "))

    if choice == 1:
        module.add(phoneBook)
    elif choice == 2:
        module.update(phoneBook)
    elif choice == 3:
        module.delete(phoneBook)
    elif choice == 4:
        num = module.search(phoneBook)
        print("Contact information:", num)
    elif choice == 5:
        module.show(phoneBook)
    elif choice == 6:
        repeat = False
        break

# updating info
print("\n\nUpdating information...")
Esempio n. 22
0
import module

a = 20
b = 50
c = module.add(a, b)
print(c)
Esempio n. 23
0
import module as m
from module2 import qq, dd

qq()
print(dd(17, 23))
m.hi ()
print(m.add (46, 14))
Esempio n. 24
0
import module
print(module.add(2,4))
print(module.sub(3,5))
Esempio n. 25
0
#모듈
# from 안쓰면 module. 이렇게 해야함 from 쓰면 module 안붙여도됨
import module

#from module import MarketGoods, add

fish1 = module.MarketGoods(size=20, price=500)
fish1.show()

print(module.add(3, 5))
Esempio n. 26
0
import module

print(module.add(4, 5.5))

# --------------------------------------------------------

# import statement example
# to import standard module math

import math
print("The value of pi is", math.pi)

# --------------------------------------------------------

# import module by renaming it

import math as m
print("The value of pi is", m.pi)

# --------------------------------------------------------

# import only pi from math module

from math import pi
print("The value of pi is", pi)

# --------------------------------------------------------

# import all names from the standard module math

from math import *
Esempio n. 27
0
from module import add

add(1, 2)

Esempio n. 28
0
# Если мы не уверены в налчии какоголибо модуля (что он есть у нас в доступном списке)
# мы можем написать следующую конструкцию коорая и проверит на наличие данного модуля: и если нет
# то при компиляции нам выдадется ImportError (Модуля несуществует):
try:
    import name_module
except ImportError:
    print("Модуля name_module не существует"
          )  # "Модуля name_module не существует"
print(r.random())

# Теперь оздадим свой модуль , в папке trening я создал файл с название module.py тепер импортируем его :
import module  # подключаем созданный нами модуль (module.py)
# import module as m  также можно писать псивданим m.hi , m.add ;

module.hi()  # вызываем наш модуль с функцией def hi (module.py) : Hello
print(module.add(45,
                 15))  # вызываем наш вторую функцию def add (module.py) : 60

# from module import (hi, add) можно также вызываеть одельные ункции из модудля таким образом (даже можн не ставить скобки)

from module import hi, add
hi()  # Hello
print(add(45, 15))  # 60
# данной записью мы говорим что из нашего модуля нам нужно импортировать только определенные
# функции hi, add (тем самым мы можем к ней проще обращаться при вызове не нужно писать
# конструкции как на примере выше module.add или module.hi ..

from module import hi as h, add as a  # и даже при вызове функции мы можем использовать псевдоним к премеру вместо
# add писать a вместо hi писать h

h()  # Hello
print(a(45, 15))  # 60
Esempio n. 29
0
from module import sub, add, mul, div, rt

print(
    "  Menu \n \n --------\n 1: add \n 2: sub\n 3: multiply\n 4: divide \n 5: root\n 6:stop\n "
)
user = int(input(": "))
if user == 6:
    print("프로그램을 종료합니다.")
elif user == 5:
    r_first = int(input("num1: "))
    print(rt(r_first))
elif user not in range(1, 7):
    print("Beep!")
else:
    first = int(input("num1: "))
    second = int(input("num2: "))
    if user == 1:
        print(add(first, second))
    if user == 2:
        print(sub(first, second))
    if user == 3:
        print(mul(first, second))
    if user == 4:
        print(mul(first, second))
Esempio n. 30
0
import module as mod
print mod.add(10, 20)
Esempio n. 31
0
import module
print module.add(3, 5)

score = 80
if score >= 90:
    print "youxiu"
elif score > 80 and score <= 90:
    print "lianghao"
elif score > 60 and score <= 80:
    print "yiban"
else:
    print "chongkao"

name = "bbb"
if name == "aaa":
    print name
else:
    print "bucunzai"

a = 3
b = 2
c = a**b
print "c:", c
c += a
print "c", c

numbers = [1, 2, 3, 4, 5, 6]
even = []
old = []
while len(numbers):
    number = numbers.pop()