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

2nd Jun 2018, 7:35 PM
ankush_953
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 :)
2nd Jun 2018, 9:08 PM
Just A Rather Ridiculously Long Username
+ 1
Why is the c++ tag here?
2nd Jun 2018, 8:00 PM
Kirk Schafer
Kirk Schafer - avatar
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.
3rd Jun 2018, 1:56 AM
ankush_953
0
I forgot to typecast total. Thanks. :)
3rd Jun 2018, 1:59 AM
ankush_953