+ 8

Why is print('a' + 'b') giving out Numbers?

Two chars in Addition give out a number

28th Jun 2019, 7:14 AM
Felix Gautsch 🍕
Felix Gautsch 🍕 - avatar
6 Antworten
+ 7
Solethink like that, yep. I had this ohne in a challenge but cant understand it :b
28th Jun 2019, 7:30 AM
Felix Gautsch 🍕
Felix Gautsch 🍕 - avatar
+ 5
the ASCII value of the characters are being added
28th Jun 2019, 7:32 AM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
+ 5
Well when 'a' is converted to int, it is 97, if 'b' is converted to int it is 98. Because chars might not have any addition rules, they were converted to integers, both.
28th Jun 2019, 7:32 AM
Seb TheS
Seb TheS - avatar
+ 4
In ascii numbers start from 49, uppercase letters start from 65, and lowercase letters start from 97.
28th Jun 2019, 7:34 AM
Seb TheS
Seb TheS - avatar
+ 3
Was the number 195?
28th Jun 2019, 7:29 AM
Seb TheS
Seb TheS - avatar