# Budget app syntax problem

**URL:** <https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [April 12, 2021, 3:56pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537 "2021-04-12T15:56:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![catalinakb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/catalinakb/32/213693_2.png) [@catalinakb](https://forum.freecodecamp.org/u/catalinakb)\
**Post date:** [April 12, 2021, 3:56pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/1 "2021-04-12T15:56:38Z")

</div>

I seem to have a problem with the budget app, it always gives me this one specific syntax error

```auto
def withdraw(self, amount, description=""):
        if(self.check_funds(amount)):
            self.ledger.append({"amount": -amount, "description": description})
            return True
        return False

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 12, 2021, 4:10pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/2 "2021-04-12T16:10:22Z")

</div>

what error do you get?

* * *

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![catalinakb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/catalinakb/32/213693_2.png) [@catalinakb](https://forum.freecodecamp.org/u/catalinakb)\
**Post date:** [April 12, 2021, 4:25pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/3 "2021-04-12T16:25:44Z")

</div>

Oh thank you, didn’t know that.  
 ![Screenshot 2021-04-12 at 17.22.39](https://global.discourse-cdn.com/freecodecamp/original/3X/e/9/e9e1efb470f97954bc4b470ba2e08de194352140.png)  
I get a syntax error and I’m not quite sure why

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 12, 2021, 4:26pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/4 "2021-04-12T16:26:31Z")

</div>

what does the syntax error say?

---

<div class="post-metadata">

**Author:** ![catalinakb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/catalinakb/32/213693_2.png) [@catalinakb](https://forum.freecodecamp.org/u/catalinakb)\
**Post date:** [April 12, 2021, 4:27pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/5 "2021-04-12T16:27:43Z")

</div>

“code”: “syntax-error”,  
“severity”: 8,  
“message”: “invalid syntax (, line 30)”,

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 12, 2021, 4:28pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/6 "2021-04-12T16:28:08Z")

</div>

and what’s above it?

---

<div class="post-metadata">

**Author:** ![catalinakb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/catalinakb/32/213693_2.png) [@catalinakb](https://forum.freecodecamp.org/u/catalinakb)\
**Post date:** [April 12, 2021, 4:28pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/7 "2021-04-12T16:28:47Z")

</div>

```auto
class Category:
    def __init__ (self, name):
        self.name = name
        self.ledger = list()
    
    def __str__ (self):
        title = f"{self.name: *^30}\n"
        items = ""
        total = 0
        for items in self.ledger:
            item +=f"{item['description'][0:23]:23}" + f"{item['amount']:>7.2f}" + "\n"

            total += item ["amount"]
        output= title + items + "Total: " + str(total)
        return output

    def deposit(self, amount, description=""):
        """A deposit method that accepts an amount and a description. 
        If no description is given, it should default to an empty string. 
        The method should append an object to the ledger list in the form 
        of {"amount" : amount, "description": description}
    """
    self.ledger.append({"amount": amount, "description": description}

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 12, 2021, 4:29pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/8 "2021-04-12T16:29:34Z")

</div>

aren’t you missing a `)`?

---

<div class="post-metadata">

**Author:** ![catalinakb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/catalinakb/32/213693_2.png) [@catalinakb](https://forum.freecodecamp.org/u/catalinakb)\
**Post date:** [April 12, 2021, 4:30pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/9 "2021-04-12T16:30:52Z")

</div>

I just found it. Thank you

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 12, 2021, 4:31pm UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/10 "2021-04-12T16:31:22Z")

</div>

when there is a werid syntax error, always look what’s before it

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [October 12, 2021, 4:32am UTC](https://forum.freecodecamp.org/t/budget-app-syntax-problem/455537/11 "2021-10-12T04:32:08Z")

</div>

Closed on October 12, 2021, 4:32am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
