ranceforhiwd / Python-Practice

Practice python routines
1 stars 0 forks source link

Create sales tax calculator #12

Closed ranceforhiwd closed 6 months ago

ranceforhiwd commented 7 months ago

Here is the formula for sales tax:

Image

Given:

Here's a list of items and their prices. Convert this list into a Python dictonary then use it to loop through and calculate the final prices of each item after a sales tax of 0.48 has been applied.

Create a new branch from this issue and clone the current code. Create a python file named tax_calc.py

When your program is working, create a pull request to merge the new file into the main branch

Refer to all the notes in the AWS test lambda functions we created with example code for various Python project challenges. This should be completed within 5 hours.

Finally

Bgaines0808 commented 7 months ago

reading reference on sales tax

Bgaines0808 commented 7 months ago

image i created the branch and the file now im working on the list

ranceforhiwd commented 7 months ago

A common practice is to fully test your code locally and make sure that it works before you make a commit then test again before you make a request

ranceforhiwd commented 7 months ago

You will need to make several commits today

Bgaines0808 commented 7 months ago

image working on the probblem

ranceforhiwd commented 7 months ago

What problem I need details error messages, line numbers, and code

Bgaines0808 commented 7 months ago

image adjusting my indentation

Bgaines0808 commented 7 months ago

image i fixed it

ranceforhiwd commented 7 months ago

This is bad because you you're about to try a pool request that will close this issue what you want to do is a commit to your remote branch if it works

ranceforhiwd commented 7 months ago

As I already stated in this project, do not submit a pool request until it is your final answer, and the program works entirely until then you can make commits to your own remote branch

Bgaines0808 commented 7 months ago

image it works and i committed it to the repo

ranceforhiwd commented 7 months ago

Can you explain your output and research how to only leave two decimal places because that's the format for US currency

Bgaines0808 commented 7 months ago

https://stackoverflow.com/questions/11722533/rollback-a-git-merge

reading

Bgaines0808 commented 7 months ago

image i ran git log

Bgaines0808 commented 7 months ago

Image

I ran git reset bt nothing changed immediately

Bgaines0808 commented 7 months ago

Image

Image

Bgaines0808 commented 7 months ago

i found a reference that rolls or reverts a change back , for the terminal (top) and tommorrow i need to figure out how to revert the change back that what i need to finish the project

Bgaines0808 commented 7 months ago

image

Bgaines0808 commented 7 months ago

https://stackoverflow.com/questions/8362792/how-do-i-shift-the-decimal-place-in-python

Bgaines0808 commented 7 months ago

I feel like before I can use any of those references first I must declare the sales tax variable although i may still be wrong thats what im thinking.

ranceforhiwd commented 7 months ago

image

There are no comments to this update. What does it mean?

ranceforhiwd commented 7 months ago

https://stackoverflow.com/questions/8362792/how-do-i-shift-the-decimal-place-in-python

this is not a good reference because it doesn't solve your problem

Bgaines0808 commented 7 months ago

https://www.w3schools.com/python/python_dictionaries.asp

image I made a dictionary with the items listed and i need my loop to start going through each item

Bgaines0808 commented 7 months ago

image I got the items to print to the screen bt i wasnt able to make the prices show

Bgaines0808 commented 7 months ago

I was able to finish with getting the items to print to the screen , the prices didnt show bt ill look into tomorrow . also i cant tell if the sales tax was applied.The "tax variable" was declared bt see its application im not sure of.

Bgaines0808 commented 7 months ago

image I tried this formula cause it looked like it would multiple everything by the variable tax bt i dont think that worked

Bgaines0808 commented 7 months ago

image

https://stackoverflow.com/questions/1841565/valueerror-invalid-literal-for-int-with-base-10

Bgaines0808 commented 7 months ago

image I tried to convert to a float

Bgaines0808 commented 7 months ago

is the dictionary in the right spot? to multiply it by the sales tax (.48) by all the items in the dictionary its next to the float (thisdict)

Bgaines0808 commented 7 months ago

I put the other variables in front of the dictionary so it wouldnt say its undefined

ranceforhiwd commented 7 months ago

image I tried to convert to a float

your dictionary values are the wrong datatype

ranceforhiwd commented 7 months ago

Your initial dictionary declaration is not the correct data type for the values. Investigate declaring a dictionary of decimal values.

Bgaines0808 commented 7 months ago

image so my dictionary looks a bit different now and im getting a error that saying my arguments are repeating [SyntaxError: keyword argument repeated]

Bgaines0808 commented 7 months ago

i dont thinks its right i added in the .48 cent my self individually, the program should have done that

ranceforhiwd commented 7 months ago

image

so my dictionary looks a bit different now and im getting a error that saying my arguments are repeating [SyntaxError: keyword argument repeated]

Every time you declare value inside a quotes, it becomes a string

Bgaines0808 commented 7 months ago

image are they saying my key is repeating not the value

Bgaines0808 commented 7 months ago

if its repeating i should just say item 1x and list the all the items in the dictionary?

ranceforhiwd commented 7 months ago

image

so my dictionary looks a bit different now and im getting a error that saying my arguments are repeating [SyntaxError: keyword argument repeated]

Every time you declare value inside a quotes, it becomes a string

The dictionary is not the correct syntax

Bgaines0808 commented 7 months ago

image I took all the parenthesis off my dictionary bt now its saying all my keys cant befined also, the tutorial has quotes image

ranceforhiwd commented 7 months ago

can we talk about this:

image
Bgaines0808 commented 7 months ago

Updating my project I needed to correct the form and put quotes around the word in the key and no quotes for the values or integers but I'm taking a break. I will be back after my doctor appointment. image

Bgaines0808 commented 7 months ago

working image image

Bgaines0808 commented 6 months ago

so to perform this exercise i need to complete all 4 at one time? y=2.8 b=int(y) print(b) print (type(b))

image all four need to be done to convert a float to a integer? image

Bgaines0808 commented 6 months ago

image im not sure 100% which line is breaking bt i know its "thisdict" is one of them

Bgaines0808 commented 6 months ago

when I troubleshoot 1st I copy and paste the problem into google. Then I look for references online for people who solved similar problems on forums like stackover flow. I also look for online videos were they are talking me through on youtube.

ranceforhiwd commented 6 months ago

when I troubleshoot 1st I copy and paste the problem into google. Then I look for references online for people who solved similar problems on forums like stackover flow. I also look for online videos were they are talking me through on youtube.

This is a great start, follow those steps and you'll solve issues faster.

Bgaines0808 commented 6 months ago

in this example, what does self mean? image

ranceforhiwd commented 6 months ago

I uploaded the solution in the repo for this project

Image

Bgaines0808 commented 6 months ago

briandoc.python.pdf

ranceforhiwd commented 6 months ago

briandoc.python.pdf

I'm downloading and reviewing your report on this practice assignment.