Jun-24-2022, 05:01 PM
(Jun-24-2022, 04:56 PM)Axel_Erfurt Wrote: I don't have the values from your table, so a generic example
prices = [33, 34.55, 45.12] quantities = [2, 1, 5] total_price = 0.0 def calculate_value(): total_price = 0.0 for row in range(len(prices)): QuantityValue = float(prices[row]) PriceValue = float(quantities[row]) QuanityPriceValue = QuantityValue*PriceValue print("QuanityPriceValue:", QuanityPriceValue) total_price += QuanityPriceValue print("total price:",total_price) calculate_value()
Output:QuanityPriceValue: 66.0 QuanityPriceValue: 34.55 QuanityPriceValue: 225.6 total price: 326.15
Thanks! That's exactly what I was looking for.