Create Purchasing Information and Receipts for Lovely Loveseats(Python Functions and Logic(

Link for the project:

Can you let me know if the given code is correct?

Hi thanks for sharing your code :)!

What specifically about it are you wondering is correct or not?

This is exercise code so as long as you understand the concepts they were teaching, you can think of it as passable.

You can additionally look out for programming principles, like DRY (don’t repeat yourself).

For example:

customer_one_total += lovely_loveseat_price
customer_one_total += luxurious_lamp_price
customer_one_total += customer_one_tax

can simplify to:

customer_one_total += lovely_loveseat_price + luxurious_lamp_price + customer_one_tax

But again I would hesitate to say this example shows “correct” over “incorrect”, since the one-by-one approach can model a certain order a “shopping-cart” program might take (though you wouldn’t code it as such). So it’s also a question of pedagogy for understanding inner workings of a program vs. what the final code might look like.

1 Like

Thank you for your suggestions! I am just a beginner taking my baby steps in coding.

I would surely try to keep my program optimized and avoid repeating of things. :slight_smile: