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 are negative effects on the Silk Road
Is 3.6 km or 3,600 m is greater or eqaul
i have 3 hundreds 17 tens 13 ones 1 tenths and 2 hundredths
Is 3.6 km or 3,600 m is greater or eqaul
The GCF of two numbers is 871. Both numbers are even and neither is divisible by the other. What is the smallest that these two numbers could be?
How did elevated trains and subways improve urban transportation?
the ratio of adults to children attending a new exhibit st the museum was found to be 8:5. Based on this ratio if 390 people attended one day, how many would be
William Penn believed that the success of his colony depended on what
what is 20 divided by 2(5+5)
Who was chosen to build the dome for the Santa Maria del Fiore in Florence? This person set bricks in a herringbone pattern. This person also invented a hoist t