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

During one day at an office, one-half of the amount of money in the petty drawer was used in the morning, and one-third of the ramining money was used in the af
inequality for g-13<19
Which pair of words is the most similar to the relationship below ? (desert : dry)A. pottery : shardB. gold : valuableC. chair : valuableD. active :
A set of 4 chromatids that are connected together
Plz I need help. 1. You have to write an equation in standard form (ax^2+bx+c=0) that represents the problem, 2. solve by factoring if possible, if not possible
Help fill in the blanks plz
really need help ???
I need help on question 8
If 16.8 mL of the analyte H2C2O4 (oxalic acid) is titrated with 0.501 M KOH to 13.54 mL, determine the mass of the analyte.​
Give one fact about each Supreme Court Justice