+ 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?

29th Apr 2021, 10:12 AM
Marjaf
Marjaf - avatar
8 Respostas
+ 6
print(bin(eval(input()))[2:])
29th Apr 2021, 11:57 AM
Oma Falk
Oma Falk - avatar
+ 4
+ is not allowed? How about -(-number), number.__add__(number) or sum(list) ?
29th Apr 2021, 10:35 AM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
+ 1
It should be quite easy to sum up binary decimals without + operator if you just can convert the numbers to binary.
29th Apr 2021, 12:18 PM
Seb TheS
Seb TheS - avatar
+ 1
U can use either concatenation r else use append
1st May 2021, 6:19 AM
Bindhu Shree G
Bindhu Shree G - avatar
0
(,) concatenation can used
30th Apr 2021, 4:32 AM
Rohith Paul Mathew
Rohith Paul Mathew - avatar
0
CarrieForle no sum, -(-) ,... is not allowed too😓
30th Apr 2021, 8:22 AM
Marjaf
Marjaf - avatar
0
Mirielle Frogged Rohith Paul Mathew Seb TheS Thank you so much 💓
30th Apr 2021, 8:24 AM
Marjaf
Marjaf - avatar
0
You can tickmark the answer you liked as the solution. That'll help people looking for the same answer.
1st May 2021, 2:17 AM
Sheikh
Sheikh - avatar