Python function/argument 'not defined' error
<p>I'm very new to coding, and am working on an assignment in Python 3.5.2 and am getting a 'display_results not defined' error.  Am I placing it in the wrong section?<br>
Thanks in advance. </p>

<pre><code>hourly_pay_rate  = 7.50
commission_rate  = 0.05
withholding_rate = 0.25

def startup_message():
    print('''This program calculates the salesperson's pay.
Five values are displayed.
Hourly pay, commission, gross pay, withholding, and net pay.\n''')

def main():
    startup_message()
    name = input('Enter name: ')
    sales_amount = float(input('Enter sales amount: '))
    hours_worked = float(input('Enter hours worked: '))
    hourly_pay_amount = hours_worked * hourly_pay_rate
    commission_amount = sales_amount * commission_rate
    gross_pay = hourly_pay_rate + commission_rate
    withholding = gross_pay * withholding_rate
    net_pay = gross_pay - withholding
display_results#&lt;-----'not defined' error for calculations

def display_results(): #(parameters)
    print('Hourly pay amount is: ', \
          format(hourly_pay_amount, ',.2f'))
    print('Commission amount is: ', \
          format(commission_amount, ',.2f'))
    print('Gross pay is: ', \
          format(gross_pay, ',.2f'))
    print('Withholding amount is: ', \
          format(withholding, ',.2f'))
    print('Net pay is: ', \
          format(net_pay, ',.2f'))


main()
input('\nPress ENTER to continue...')
</code></pre>

<p>Look at this very short program:</p>

<pre><code>def main():
    r = 2 + 2

show_result

def show_result():
    print("The result of 2+2 is {}", format(r))

main()
</code></pre>

<p><strong>This program will not work!!</strong> However, if you can fix all the bugs in this program you will have understood how to fix most of the problems in your longer example.</p>

<p>Here is an annotated solution:</p>

<pre><code>def main(): 
    r = 2 + 2 
    show_result(r)  # Must indent. Include brackets and pass the      
                    # variable

def show_result(r): # Include a parameter list.
    print("The result of 2+2 is: {}".format(r))  # format is a string method     
main() 
</code></pre>

<p>You need to indent and pass parameters to <code>display_results</code> and use the <a href="https://docs.python.org/3.5/library/string.html#format-specification-mini-language" rel="nofollow">correct syntax for format strings</a>. In your case something like:</p>

<pre><code>print('Hourly pay amount is: {.2f}'.format(hourly_pay_amount))
</code></pre>

python undefined