0
What is wrong in this code ?
We are given an array and a number. We have to find if there exists two numbers in array whose sum is equal to given number. https://code.sololearn.com/c6rXq0A2cVuO/?ref=app
4 Antworten
+ 2
Good solution!
First off, it is a bad idea to reassign built-in functions and variables because you can't use the original function/variable again. In your case, try and use another name for the variable 'sum', such as 'total'.
----------------------
The problem with the code is that you need to convert the second input to an integer. So line 6 should look like:
total = int(input('Enter sum: '))
Then, just replace all occurrences of 'sum' to 'total' and you should be good :)
+ 1
Why is the c++ tag here?
0
Because I think python is almost like pseudo code so anyone can understand it and most of competitive programmers prefer c++ hence if there is any, he/she may help.
0
I forgot to typecast total. Thanks. :)