runtime error - question

1

In this problem, you should read the code of a part 1, the number of parts 1, the unit value of each part 1, the code of a part 2, the number of parts 2 and the unit value of each part 2. After, calculate and show the amount to be paid.

Entry

The input file contains two rows of data. In each line there will be 3 values, respectively two integers and a value with 2 decimal places.

Output

The output should be a message according to the example given below, remembering to leave a space after the colon and a space after the "R $". The value should be presented with 2 houses after the point.

código_peça_1 = int(input())
número_peça_1 = int(input())
valor_peça_1 =  float(input())
código_peça_2 = int(input())
número_peça_2 = int(input())
valor_peça_2 =  float(input())
valor_a_pagar = ( número_peça_1 * valor_peça_1 ) + ( número_peça_2 * valor_peça_2 )
print("VALOR A PAGAR = R$ %.2f" %valor_a_pagar)
    
asked by anonymous 29.09.2018 / 00:37

1 answer

1
  

The input file contains two rows of data.

Then you should do only two readings of the input and divide the values:

entrada = input().split()
codigo_1 = int(entrada[0])
quantidade_1 = int(entrada[1])
valor_1 = float(entrada[2])

entrada = input().split()
codigo_2 = int(entrada[0])
quantidade_2 = int(entrada[1])
valor_2 = float(entrada[2])

And so, calculate the result.

    
29.09.2018 / 02:03