Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import random
- def calcv(latitud,t):
- return (23.5*math.sin(math.pi*(t-80)/180)+90-latitud)/90
- def decide(v):
- if 0<v<1:
- return v**2
- if v>=1:
- return 1
- if v<=0:
- return 0
- def calcenergy(f):
- return area*f*sundigit*random.random()
- area=500
- sundigit=10
- t=int(input("How many latitudes do you want to calculate?"))
- x=0
- listalatitud=[]
- while x<t:http://pastebin.com/HyM2S8uA
- latitud=int(input("latitud"))
- if latitud>0 and latitud<90:
- listalatitud.append(latitud)
- x=x+1
- else:
- print("Next time say a latitude between 0 and 90")
- lista=[]
- total=0
- for latitud in listalatitud:
- tmp = []
- for t in xrange(365):
- v=calcv(latitud,t)
- f=decide(v)
- l=calcenergy(f)
- tmp.append(l)
- lista.append(tmp)
- for i in lista:
- print "Year average", sum(i) / float(len(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement