Syntax error with a while loop in python
<p>This is my script, its a script that works like a calculator, however when i run it, it gives me invalid syntax for the while loop? i am new to python help me please.</p>

<pre><code>import functools
numbers=[]

def mean():
    end_mean = functools.reduce(lambda x, y: x + y, numbers) / len(numbers)
    print(end_mean)

def sums():
    end_sum = functools.reduce(lambda x, y: x + y, numbers)
    print(end_sum)

def whatDo():
    print('Input Extra Numbers '+str(len(numbers)+1)+' (or nothing to close):')
    try:
        number= int(input())
        numbers.append(number)
    except:
        print('What do you want to do?')
        answer = input()
        if answer == "mean":
            mean()
        elif answer == 'sum':
            sums()
        elif answer== 'median':
            median()

def median():
    numbers.sort()
    medianNumber=int(len(numbers))
    if medianNumber%2==0:
        end_median=numbers[int(len(numbers))/2]+numbers[int(len(numbers))/2+1]
    if medianNumber%2==1:
        numbers[int(len(numbers))+1/2

while True:
    print('Input Number '+str(len(numbers)+1)+' (or nothing to close):')
    try:
        number= int(input())
        numbers.append(number)
    except:
        print('What do you want to do?')
        answer = input()
        if answer == "mean":
            mean()
        elif answer == 'sum':
            sums()
        elif answer== 'median':
            median()
        print('Do you want anything else?')
        reply=input()
        if reply=='no':
            break
        elif reply=='yes':
             whatDo()
        else:
            break
</code></pre>

<p>i did remove the while loop but then it said that the print function was invalid. please keep in mind that i am new to python.</p>

<p>Before the while loop add the closing bracket to the line:</p>

<p><code>numbers[int(len(numbers))+1/2]</code></p>

<p>Usually it is a good idea to always check the lines above where the error occurred, if python is telling you that is found a <code>SyntaxError</code> but your syntax seems valid.</p>

python