repl.it
@Blan/

Average Function

Python

Used for a math proof on Brilliant.org. The link to the proof is here: https://brilliant.org/discussions/thread/just-an-average-proof

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
from statistics import mean
x = float(input("Enter x: "))
y = float(input("Enter y: "))
a = x
b = y
counter = 0 #keeps the code from infinitely looping
while counter < 9999:
    lst = [x, y]
    function = mean(lst)
    x = y
    y = function
    counter += 1
print("f(%s, %s) is approximately %s" % (a, b, function))
?