+ 3
Add Numbers without using "+"
Hi I have to write a program that, for example takes an input, like this: 2 + 4 + 20 + 4+.... and displays the binary equivalent of their sum in the output. and I'm not allowed to use + to add Numbers in the program. I can only use + in the input itself. can anyone give me an idea to solve?
8 Answers
+ 6
print(bin(eval(input()))[2:])
+ 4
+ is not allowed?
How about -(-number), number.__add__(number) or sum(list) ?
+ 1
It should be quite easy to sum up binary decimals without + operator if you just can convert the numbers to binary.
+ 1
U can use either concatenation r else use append
0
(,) concatenation can used
0
CarrieForle no sum, -(-) ,... is not allowed toođ
0
0
You can tickmark the answer you liked as the solution. That'll help people looking for the same answer.