-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathdrake.py
32 lines (26 loc) · 1.15 KB
/
drake.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from VALID import ny
def se(q):
while True:
p = input(q)
try:
r = float(p)
break
except Exception as e:
r = str(e)
print(r)
return r
while True:
print("----------------------------------------DRAKE EQUATION----------------------------------------")
print("----------------------------N = R* x fp x ne x fl x fi x fc x L-------------------------------")
R = se("Average rate of star formation in the galaxy (new stars per year): ")
fp = se("Fraction of stars with planets: ")
ne = se("Stars with planets, the average number of planets with an environment suitable for life: ")
fl = se("Fraction of planets that develop life: ")
fi = se("Fraction of lifebearing planets with intelligent, civilized life: ")
fc = se("Fraction of civilizations that release detectable signs of their existence into space: ")
L = se("Length of time (in years) over which the civilizations release the detectable signals: ")
N = R*fp*ne*fl*fi*fc*L
print("\n{} Civilitations.".format(N))
conti = ny(input("Continue(n/y)?: "))
if conti == "n":
break