#πŸ”’ My program is to calculate the amount of a meal purchased at a restaurant

37 messages Β· Page 1 of 1 (latest)

wooden saddle
#

Here is my code ( my problem is that the value is not displaying but instead its displaying the code that i wrote for my output instead)
#This program will calculate your total amount of a meal purchased at a restaurant
OriginalCost = float(input(' what was your total amount of the meal purchased at the restaurant?'))
Tip = .18
TipC = (Tip * OriginalCost)
Tax = .07
TaxC = (Tax * OriginalCost)
Totalamount = (OriginalCost + TipC + TaxC)
print('your original cost is', "OriginalCost")
print('The tip is', "TipC")
print('The tax is', "TaxC")
print('The total cost is', "Totalamount")

hoary hazelBOT
#

@wooden saddle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

wintry wagon
#

you need to remove the double quotes around the variables

#

does this help?

wooden saddle
#

i will try it! and see what happens

#

it still gives me the same result

little pier
wintry wagon
#

not if using variables

little pier
#
 #This program will calculate your total amount of a meal purchased at a restaurant
OriginalCost = float(input(' what was your total amount of the meal purchased at the restaurant?'))
Tip = .18
TipC = (Tip * OriginalCost)
Tax = .07
TaxC = (Tax * OriginalCost)
Totalamount = (OriginalCost + TipC + TaxC)
print('your original cost is', "OriginalCost")
print('The tip is', "TipC")
print('The tax is', "TaxC")
print('The total cost is', "Totalamount")
wooden saddle
#

ohhh i see

little pier
wooden saddle
#

the output is still the same it wont give me the value for some reason

#

it gives me this output The tip is TipC
The tax is TaxC
The total cost is Totalamount

wintry wagon
#

print('your original cost', OriginalCost

#

and not "OriginalCost"

wooden saddle
#

okay will do

wintry wagon
#

did it work?

wooden saddle
#

it did give me a value

wintry wagon
#

the correct one?

wooden saddle
#

let me adjust it with the other as well

wintry wagon
#

okay

wooden saddle
#

oh my god it worked

#

thank you dude i appreciate it

wintry wagon
#

you welcome

wooden saddle
#

since im new to coding what was the error i was making?

wintry wagon
#

a string is a list of characters and is declared by putting double quotes or single quotes

#

since you want to use a variable there's no need for ""

wooden saddle
#

oh okay so what i understand then that any variable assigned does not need quotes around it?

wintry wagon
#

exactly

wooden saddle
#

okay i really appreciate it man i hope you have a good day

wintry wagon
#

you welcome

#

anything else?

wooden saddle
#

that is all i do have another assigntment for later that i wil attempt to do if im really hard stuck on something i will make another discussion post but for now that is all

wintry wagon
#

good luck

wooden saddle
#

thank you

hoary hazelBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.