savanChristinkb3o2er savanChristinkb3o2er
  • 20-12-2016
  • Computers and Technology
contestada

what would you expect as the result of the code print(1+4)

Respuesta :

rsmith6559
rsmith6559 rsmith6559
  • 21-12-2016
I would expect it to output 5 to the screen. The plus sign is overloaded in most languages, put simpler it behaves in more than one way. This looks like Python 3.x. When given strings, the plus sign concatenates them:

print( "Hello " + "World" )
"Hello World"

When given numbers, the plus sign performs addition. When numbers and strings are mixed, an error occurs. The number needs to be converted to a string like:

print( str( 4 ) + "foo" )
Answer Link

Otras preguntas

What does Hajj mean?
What does Hajj mean?
What are the factors of 65. Like a factor tree.
A restaurant received a shipment of 42 gal of orange juice and 18 gal of cranberry juice. The juice needs to be poured into equal-sized containers. What is the
A restaurant received a shipment of 42 gal of orange juice and 18 gal of cranberry juice. The juice needs to be poured into equal-sized containers. What is the
What is the name of Fe2O3
explain it - compare 3 3/22 & 3 2/33. which is greaterI Know: Multiply the denominator by the whole number then add numerator to that. Now I have 69/66 &
What is 20% of $40.00 please help
What are the factors of 65. Like a factor tree.
explain it - compare 3 3/22 & 3 2/33. which is greaterI Know: Multiply the denominator by the whole number then add numerator to that. Now I have 69/66 &