Nix/store Error in Console

nix/store error?

Repl link/Link to where the bug appears: https://replit.com/@Patricia-AnneA4/FluidUselessMacrolanguage?v=1

when I run a project for school:

# variables for all starting values
name = "Stacey"
num_apples = 12
num_pineapples = 2
num_bananas = 1
cost_apple = 0.6
cost_pineapple = 2.50
cost_banana_pound = 0.35
banana_pounds = 5
cash = 20

# calculate total items
total_items = num_apples + num_pineapples + num_bananas

# calculate total cost
total_cost_apples = num_apples * cost_apple
total_cost_pineapples = num_pineapples * cost_pineapple
total_cost_bananas = num_bananas * cost_banana_pound * banana_pounds
total_cost = total_cost_apples + total_cost_pineapples + total_cost_bananas

# calculate average price per item
avg_price = total_cost / total_items

# calculate change
change = cash - total_cost

# printing receipt
print("-----------")
print("Customer: " + name)
print("Number of Items: " + str(total_items))
print("Total Cost: $" + str(total_cost))
print("Average Cost: $" + str(avg_price) + " per item")
print("Paid: $" + str(cash))
print("Change: $" + str(20-13.95))
print("-----------")

i’ve done everything right but right before my code runs

Screenshot 2023-09-23 110220

my console says:

/nix/store/zqk3m21442kvpjwd3rh41wdavqkzkyik-python3-wrapper/bin/python3 $file
-----------
Customer: Stacey
Number of Items: 15
Total Cost: $13.95
Average Cost: $0.9299999999999999 per item
Paid: $20
Change: $6.050000000000001
-----------

as you can see there is a nix thing? and it messes up my change ??

:wave: Welcome to the community, @Patricia-AnneA4!

/nix/store/zqk3m21442kvpjwd3rh41wdavqkzkyik-python3-wrapper/bin/python3 $file

The reason this message is showing up is due to a few new updates on Replit and is completely normal. If you would like to remove it, go to your .replit file and put the following code on line 1: run = "clear && python3 main.py".

If you’d like, you can invite me to your repl and I can do it for you. My Replit username is RedCoder.


There is also a small error in your code. If you invite me to your repl, I’ll fix it for you.


If this helps, please mark it as a solution.

2 Likes

Welcome to Ask! The nix/store message is not an error and Replit is working on getting rid of it. The reason your decimal numbers are so long is because you didn’t round them. Try adding avg_price = round(avg_price, 2) to line 23 and use the same method for anything else you want to round.

2 Likes