Esempio n. 1
0
def main():
    print('testing maths module', __name__)
    s = sum(1, 2, 3, 4, 5)
    a = average(1, 2, 3, 4, 5)
    print('values 1,2,3,4,5')
    print('sum is ', s)
    print('average is ', a)
Esempio n. 2
0
def main():
    ans = True
    while ans:
        lo = utils.read_int('min?')
        hi = utils.read_int('max?')
        primes = p.prime_range(lo, hi)
        result = average(*primes)
        print('total primes in range ({}-{}) is {}'.format(
            lo, hi, len(primes)))

        print('average of {} is {}'.format(primes, result))

        ans = utils.read_bool('continue?')
Esempio n. 3
0
def main():
    run = True
    while run:
        min = consoleutils.read_int('min', 2)
        max = consoleutils.read_int('max', 100)
        primelist = primes.prime_range(min, max)
        tot = maths.sum(*primelist)
        avg = maths.average(*primelist)

        print('primes is range {}-{} are {}'.format(min, max, primelist))
        print('sum of all primes is {}'.format(tot))
        print('average of all primes is {}'.format(avg))

        run = consoleutils.read_bool('repeat', 'yes')
Esempio n. 4
0
def main():
    lo = int(input('min?'))
    hi = int(input('max?'))

    primes = p.prime_range(lo, hi)  #from primes.py
    s = maths.sum(*primes)  #from math.py
    a = maths.average(*primes)  #from math.py
    lowest = min(primes)  # python function
    highest = max(primes)  # python function

    print('primes are ', primes)
    print('sum is ', s)
    print('average is ', a)
    print('lowest is ', lowest)
    print('higest is ', highest)
Esempio n. 5
0
def main():
    run=True
    
    while run:
        lo=ci.read_int('min?')
        hi=ci.read_int('max?')
        primes=p.prime_range(lo,hi)
        sum=maths.sum(*primes)
        avg=maths.average(*primes)
        small=min(*primes)
        print('all primes',primes)
        print('sum',sum)
        print('average',avg)
        print('lowest prime',small);

        run=ci.read_bool('continue?')
Esempio n. 6
0
def main():
    global primes
    repeat=True
    while repeat:
        lo= consoleutils.read_int('min? ',2)
        hi= consoleutils.read_int('max?')
        
        primes=primes.prime_range(lo,hi)

        total=maths.sum(*primes)
        avg=maths.average(*primes)
        print('primes={}'.format(primes))
        print('total primes found is {}'.format(len(primes)))
        print('sum of primes {}'.format(total))
        print('average of primes {}'.format(avg))

        repeat=consoleutils.read_bool('try again?',True)
Esempio n. 7
0
def main():
    print('starting module {}'.format(__name__))
    repeat = True
    while repeat:
        lo = cu.read_int('min? ', 2)
        hi = cu.read_int('max?')

        primes = prime_range(lo, hi)

        total = maths.sum(*primes)
        avg = maths.average(*primes)
        smallest = min(*primes)
        print('primes={}'.format(primes))
        print('total primes found is {}'.format(len(primes)))
        print('sum of primes {}'.format(total))
        print('average of primes {}'.format(avg))
        print('smallest prime in series is {}'.format(smallest))
        repeat = cu.read_bool('try again?', True)
Esempio n. 8
0
def main():
    lo = 50  #int(input('min?'))
    hi = 100  #int(input('max?'))

    #no need (or option) to qualify the name with p.
    primes = prime_range(lo, hi)  #from primes.py

    #no need to qualify sum and average
    s = sum(*primes)  #overwrites builtin sum function  with my function
    a = average(*primes)
    lowest = min(
        primes)  #not importing min from maths.py. using builtin function
    highest = max(primes)

    print('results')

    print('primes are ', primes)
    print('sum is ', s)
    print('average is ', a)
    print('lowest is ', lowest)
    print('higest is ', highest)
Esempio n. 9
0
def main():
    #print(dir(p)) # lets see what is present in p
    print('welcome to the program...', __name__)
    lo = int(input('min?'))
    hi = int(input('max?'))

    #no need (or option) to qualify the name with p.
    primes = p.prime_range(lo, hi)  #from primes.py

    #no need to qualify sum and average
    s = sum(*primes)  #overwrites builtin sum function  with my function
    a = average(*primes)
    lowest = min(
        primes)  #not importing min from maths.py. using builtin function
    highest = max(primes)

    print('results')

    print('primes are ', primes)
    print('sum is ', s)
    print('average is ', a)
    print('lowest is ', lowest)
    print('higest is ', highest)
Esempio n. 10
0
#!python
print("Content-Type: text/html; charset-utf-8\n")

'''
import maths

print(maths.average(1,2,3))
print(maths.plus(1,2))
print(maths.pi)
'''

#print 에서 maths 를 안쓰기 위해서
from maths import average, plus, pi

print(average(1,2,3))
print(plus(1,2))
print(pi)
Esempio n. 11
0
def main():
    print(m.average(1, 2, 3, 4))
    print(average(7, 2))
    math()
Esempio n. 12
0
#!python
print("Content-Type: text/html; charset-utf-8\n")
'''
import maths

print(maths.average(1,2,3))
print(maths.plus(1,2))
print(maths.pi)
'''

#print 에서 maths 를 안쓰기 위해서
from maths import average, plus, pi

print(average(1, 2, 3))
print(plus(1, 2))
print(pi)
Esempio n. 13
0
def test():
    print('executing main from maths module: {}'\
        .format(__name__))
    print('sum(1,2,3,4)={}'.format(sum(1,2,3,4)));
    print('average(1,2,3,4)={}'.format(average(1,2,3,4)));