def main(): print(primes) print('type', type(primes)) print('id', id(primes)) # to see the internals of an object use dir print('contents', dir(primes)) primeList = primes.prime_range(1, 10) print(primeList)
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 print('welcome to prime app {}'.format(__name__)) while run: min=cu.read_int('min',2) max=cu.read_int('max',100) primes=prime_range(min,max) tot=sum(*primes) avg=average(*primes) print('primes is range {}-{} are {}'.format(min,max,primes)) print('sum of all primes is {}'.format(tot)) print('average of all primes is {}'.format(avg)) run=cu.read_bool('repeat','yes')
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(): repeat=True while repeat: lo= read_int('min? ',2) hi= read_int('max?') primes=p.prime_range(lo,hi) total=sum(*primes) #maths.sum has replaced builtin sum function avg=average(*primes) #maths.average() has no conflict smallest=min(*primes); #maths.min() overwrites a more useful builtin min 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=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(): run = True print('module name is ', __name__) #print(dir(p)) while run: lo = ci.read_int('min?') hi = ci.read_int('max?') primes = p.prime_range(lo, hi) total = sum(*primes) avg = average(*primes) small = min(*primes) print('all primes', primes) print('sum', total) print('average', avg) print('lowest prime', small) run = ci.read_bool('continue?')
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)
def main(): run=True print(type(primes)) print(primes.prime_range(1,10))