
December 7th, 2012, 03:40 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 2
Time spent in forums: 16 m 40 sec
Reputation Power: 0
|
|
|
Max value in for loop [SOLVED]
So i want to know the highest value in the 'for' loop listed below, but it doesnt work :s notes are added in code
Code:
import math
def main():
global r,n
n = int(input('Name the amount of individuals: '))
r = int(input('Name the amount of recombinant children: '))
print('')
bereken()
def bereken():
global LOD
for x in range(1,51,1):
z = x/100
LOD = math.log10 (((1-z)**(n-r)*(z**r))/(0.5**n))
print('At a recombinant fraction of ',float(z))
print('The maximum LOD-value is: ',float(LOD))
print('')
MAX()
def MAX():
print('The highest LOD-value is: ',max(LOD))
main()
#the LOD is 0.0 becouse x=50 (the sum equals 0)
#and in the loop LOD is overwritten each time (50 times total)
#which means its not a list please help!
|