Hi am to figure out how to code this monthly budget on python to look like this:
Item Month Year
Food $50.55 $606.60
Rent $300.00 $3600.00
Coding $3.01 $36.12
Toothpaste $1.00 $12.00
Yoga $50.00 $600.00
What have you tried? What does your code look like and what does the output look like?
it kept on saying syntax error
Enter Item 1: Food
Enter Item 1 Monthly Amount: 50.55
print input1 = input("Enter Item 1: ")
print monthly1 = float(input("Enter Item 1 Monthly Amount: "))
i tried something like this
These are the instructions * Instead of assigning the item variables directly, you will use the input() function to prompt the user for these variables. Specifically, you will input the:
- Item name (as a string)
- Item monthly amount (as a float)
- You will calculate the yearly amount for each item. Notice that all of the values are floats and are displayed with cents (this is money).
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.
Please use the “preformatted text” tool in the editor (
</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.