scientific-programming-exer.../ex_13.py

16 lines
312 B
Python
Raw Normal View History

2018-11-14 13:10:50 +00:00
from math import log10
def recursive_loss(n):
if(n == 1):
return 1
else:
return 2**(n - 1) + recursive_loss(n - 1)
if( __name__ == "__main__"):
print("On an 8x8 board you loose:", recursive_loss(8*8))
print("that is a number with "
, int(log10(recursive_loss(8*8) / 100))
, "zeros (in Euros)")