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)
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?')
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')
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)
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?')
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)
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)
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)
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)
#!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)
def main(): print(m.average(1, 2, 3, 4)) print(average(7, 2)) math()
#!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)
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)));