0

Help with this problem

What is 2+2=4-1? Please write it in python

27th Nov 2017, 4:58 PM
Cain
Cain - avatar
8 Réponses
+ 2
with magic method, you can do that. __sub__ should be overwritten to multiply. so 4-1 will be 4*1 instead. https://code.sololearn.com/cTOiQeS9ZvBU/?ref=app
30th Nov 2017, 4:44 AM
Lindsay Linjie Chen
Lindsay Linjie Chen - avatar
+ 5
print(2+2=4-1) # SyntaxError: keyword can't be an expression print("2+2=4"-1) # TypeError: Unsupported operand type(s) for -: 'str' and 'int' etc... Perhaps you mean ==?
27th Nov 2017, 5:55 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
.......... I know y u have asked this question...... Man's not hot! Damn, this song is going crazy.... anyways, print("2 + 2 = " + str(2 + 2) + " - 1, that's " + str(4 - 1))
27th Nov 2017, 5:27 PM
Cool Codin
Cool Codin - avatar
+ 2
where did u see such horrible thing... 2+2 = 4-1.... how???😁😁😁😁
27th Nov 2017, 5:26 PM
sayan chandra
sayan chandra - avatar
+ 1
@@kirk 😂😂😂
27th Nov 2017, 5:56 PM
sayan chandra
sayan chandra - avatar
+ 1
:)
30th Nov 2017, 4:46 AM
Cain
Cain - avatar
0
P = NP
27th Nov 2017, 7:24 PM
Zezima
Zezima - avatar
0
@Cool Codin haha
27th Nov 2017, 7:51 PM
Cain
Cain - avatar