def sort(left, right):
     if left == right or left > right:
         return None
     else:
         n = divide(item, left, right)
         sort(left, n - 1)
         sort(n, right)
Esempio n. 2
0
import add
import sub
import mult
import div
import sys

global a, b

args = sys.argv
# print("enter operaton:\n1-add\n2-sub\n3-prod\n4-div\nchoice:\t")
choice, a, b = args[1], int(args[2]), int(args[3])
print(choice, a, b)

ans = 0
if choice == "1":
    print("Adding", a, b)
    ans = add.addition(a, b)
if choice == "2":
    print("Subtracting", a, b)
    ans = sub.subtraction(a, b)
if choice == "3":
    print("Multiplying", a, b)
    ans = mult.multiplication(a, b)
if choice == "4":
    print("Dividing", a, b)
    ans = div.divide(a, b)

print()
print(ans)
Esempio n. 3
0
aa = tail(open("outmol"))
print aa


def print_matches(matchtext):
    print "Looking for", matchtext
    while True:
        line = (yield)
        if matchtext in line:
            print line


import div

a, b = div.divide(2305, 29)
print a, b

import div as foo

a, b = foo.divide(1000, 40)
print a, b

from div import divide

a, b = divide(2904, 12)
print a, b

#pylines = grep(aa,"time")

#for line in pylines:
Esempio n. 4
0
			b=input("Enter denominator");
		elif prev==1:
                        while 1:
				print "Enter your choice\n1.Use answer as numerator\n2.Use answer as denominator";
				e=input();
				if e==1:
					a=k;
					b=input("Enter denominator");
					break;
				elif e==2:
					a=input("Enter numerator");
					b=k;
					break;
				else:
					print "Undefined!!!";	
                k=divide(a,b);
		print "The current division is "+str(k);

#SIN
	elif c==5:
		if prev==0:
			a=input("Enter number");
		if prev==1:
			a=k;
		k=math.sin(a);
		print "The sin value is "+str(k);     

#COS
	elif c==6:
		if prev==0:
			a=input("Enter number");
Esempio n. 5
0
#!/usr/bin/env python
# -*- coding:utf8 -*-


def divide(a, b):
    q = a / b
    r = a - q * b
    return (q, r)


import div

a, b = div.divide(2305, 29)
Esempio n. 6
0
#!/usr/bin/env python
"""
Книга Девида Бизли "Python подробный справочник 4ое издание"
страница 46
Модули
"""
__author__ = "shmakovpn <*****@*****.**>"
__date__ = "2019-12-09"


import div
a, b = div.divide(2305, 29)
print(f"a={a}, b={b}")

import div as foo
c, d = foo.divide(2305, 29)
print(f"c={c}, d={d}")

from div import divide
x, y = divide(2305, 29)
print(f"x={x}, y={y}")

import string
print(f"{dir(string)}")

# получение справки
print(f"{issubclass.__doc__}")


# комплексные числа
print(f"complex result={(3 + 4j)*(5 - 2j)}")
Esempio n. 7
0
		if searchtext in line: yield line



aa = tail(open("outmol"))
print aa

def print_matches(matchtext):
	print "Looking for", matchtext
	while True:
		line = (yield)
		if matchtext in line:
			print line

import div
a, b = div.divide(2305,29)			
print a, b

import div as foo
a, b = foo.divide(1000,40)
print a, b

from div import divide
a, b = divide(2904,12)
print a, b

#pylines = grep(aa,"time")

#for line in pylines:
#	print line,
Esempio n. 8
0
__author__ = 'aravindan'

"""As your programs grow in size,you will want to break them into multiple files for easier maintainance To create a module,put the relevant statements and definitions into a file that has the same name as the
module/file must have a .py suffix"""

# file : div.py
def divide(a,b):
    q=a/b  # if a and b are integers,q is an integer
    r=a-q*b
    return (q,r)
# To use your module in other programs,you can use the import Statement

import div
a,b =div.divide(2305,29)

from div import divide
a,b = divide (2305,29)
print a,b

# To load all of a module's contents into the current namespace,you  can also use the following
from div import *
import string
print dir(string)