The program below is used to calcualte the sum of 3 numbers. There is an error in this program. Which line contains the error? num1=10 num2 =20 num3="30" sum = num1+num2+num3 print (num1) print (num2) print (num3) print (sum)

Respuesta :

ijeggs

Answer:

  1. num1=10
  2. num2 =20
  3. num3="30"
  4. sum = num1+num2+num3
  5. print (num1)
  6. print (num2)
  7. print (num3)
  8. print (sum)

The error is at line 3. The variable num3 has been assigned a string value with use of the quotes.

To fix the error, take away the quotes from the number 30, since the arithemetic operation cannot be carried out on the string in python program language.

Explanation:

In this exercise we have to use the knowledge in computational language in python to describe a code that best suits, so we have:

The code can be found in the attached image.

What is a string?

The String type is mainly used to write text information, like a person's name or a clothing brand, for example. In it we have a sequence of characters that form a string. Python allows you to form strings with a pair of single or double quotes.

To make it simpler we can write this code as:

num1=10

num2 =20

num3="30"

sum = num1+num2+num3

print (num1)

print (num2)

print (num3)

print (sum)

We have that what is missing for this code to work is a string before the value of each number.

See more about python at brainly.com/question/19705654

Ver imagen lhmarianateixeira