0
print ("Produto Numero 1")
ValorDaMercadoria = float(input("Qual o valor da mercadoria? "))
print("Produto 1",":",ValorDaMercadoria)
NumeroDoProduto = 2
ValorDaMercadoriaLaco = 1
while ValorDaMercadoriaLaco != 0:
print ("Produto Numero",NumeroDoProduto)
ValorDaMercadoriaLaco = float(input("Qual o valor da mercadoria? "))
print("Produto",NumeroDoProduto,":",ValorDaMercadoriaLaco)
NumeroDoProduto = NumeroDoProduto + 1
SomaDosPrecosDasMercadorias = ValorDaMercadoria + ValorDaMercadoriaLaco
print("Soma dos precos",SomaDosPrecosDasMercadorias)
print ("Lojas Tabajara")
Here in my code the sum is only taking my first number typed and not picking up the value that is typed inside the while.
I tried the way you suggested, but it didn’t work out. Somadosprecosdasmercadorias = Valuesmercadoria + Valuesmercadorico in this line of code above the Somadosprecosdasmercadorias only this storing the value of Valuesmercadoria, it is does not take the values typed in in the While.(Valuesmercadorico). last if I have for example x=x+1, it wouldn’t be the same as x+=1?
– Rennan Felipe
Renan, x +=1 is the same thing as x = x + 1... But in your example, you don’t use either.
– Daniel Mendes
I was able to solve this problem but I am with another. I am not using functions in my program pq in the resolution of the question can not do with function. at the end of the algorithm when it does the calculation as I do for it to manually go back to the start and ask again the values of the products?
– Rennan Felipe
If you cannot use functions, you will need to put virtually all your code within a loop.
– Daniel Mendes