Adding strings and integer | Sololearn: Learn to code for FREE!

0

Adding strings and integer

Is it possible to add a string to an integer

6/10/2022 8:02:44 AM

Mayokun Timilehin

4 Answers

New Answer

+3

Timilehin Mayokun "abc" + 12 = ?

+2

If the string value is numeric (Like 2,4 etc) then yes.

+2

Timilehin Mayokun Can you give an example if what you are trying to achieve. All letters have an underlying number, so it is possible to take the number associated with a letter, add a number to it, then convert it back to a letter. Therefore a + 3 = d That's how Caesar cypher works

+2

For what you are trying this? In which language? Direct way is language dependent .. "ABC"+12 is valid in java but error in python..