input = [10,18,20,5,11,2,10,15]
sum = 20
length = len(input)
for i in range(length):
for j in range(i+1, length):
if(input[i] + input[j] == sum):
print(input[i], input[j])
and the output is
10 10
18 2
5 15
input = [10,18,20,5,11,2,10,15]
sum = 20
length = len(input)
for i in range(length):
for j in range(i+1, length):
if(input[i] + input[j] == sum):
print(input[i], input[j])
and the output is
10 10
18 2
5 15
For further actions, you may consider blocking this person and/or reporting abuse
Recently Heroku shut down free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis on November 28th, 2022. So Meshv Patel put together some free alternatives in this classic DEV post.
Anurag Verma -
Noor E Jannat Nafia -
Tai Kedzierski -
Quokka Labs -
Once suspended, mu will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, mu will be able to comment and publish posts again.
Once unpublished, all posts by mu will become hidden and only accessible to themselves.
If mu is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to muTheTechie.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community 👩💻👨💻 safe. Here is what you can do to flag mu:
Unflagging mu will restore default visibility to their posts.
Top comments (1)
Another solution would be to use a map(or a dictionary in python, AFAIK) where each key would follow this rule: sum - list[i];