#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Help with syntax error please


    I am getting a syntax error for show_cost(totalMonthlySales)

    I need help figuring out what I did wrong

    Code:
    stateSalesTaxConversion = 0.04
    countySalesTaxConversion = 0.02
    
    def main():
        totalMonthlySales = input(float('Enter total monthly sales ')
        show_cost(totalMonthlySales)
    
    def show_cost(sales):
        stateSalesTax = sales * stateSalesTaxConversion
        countySalesTax = sales * countySalesTaxConversion
        totalTax = stateSalesTax + countySalesTax
    
        print('The State Tax collected is ', stateSalesTax)
        print('The county Tax collected is ', countySalesTax)
        print('The Total Tax collected come to ', totalTax)              
    
    main()
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Location
    39N 104.28W
    Posts
    156
    Rep Power
    2
    Which version of Python are you using?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    451
    Rep Power
    32
    You didn't close the parens on the previous line. But the previous line is still not correct. I would suggest you get the input and then convert to a float until you understand how it works. And as rrashkin said above, whether you are getting input correctly or not depends on which version of Python you are using. Finally,
    stateSalesTaxConversion = 0.04
    countySalesTaxConversion = 0.02
    should be within the show_cost function since that is the only place they are used and so should be local variables.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0
    thanks a lot, the float advise helped more then the bracket

IMN logo majestic logo threadwatch logo seochat tools logo