You are given a list of integers. Find the sum of the unique numbers in the list.

AnswerBot
2y

Find the sum of unique numbers in a list.

  • Create an empty set to store unique numbers

  • Loop through the list and add each number to the set

  • Sum up the numbers in the set

Devi S
1y
a=[1,2,3,4,1,2,100] b={} for i in a: if i in b.keys(): b[i]+=1 else: b[i]=1 count=sum([k for k,v in b.items() if v==1])
Atmuri Ganesh
2y
a=[1,2,3,4,1,2,100]
n=[]
for i in a:
    if i not in n:
        n.append(i)
print(n)
sum=0
for i in n:
    sum+=i
print(sum)
Atmuri Ganesh
2y
a=[1,2,3,4,1,2,100]
s=set(a)
sum=0
for i in s:
    sum+=i
print(sum)
Select
Add answer anonymously...

Accenture Python Developer interview questions & answers

A Python Developer was asked 7mo agoQ. Define a lambda function and provide an example.
A Python Developer was asked 7mo agoQ. What are the differences between a list and a tuple?
A Python Developer was asked 7mo agoQ. What is a namespace and what are its types?

Popular interview questions of Python Developer

A Python Developer was asked 7mo agoQ1. Define a lambda function and provide an example.
A Python Developer was asked 7mo agoQ2. What are the differences between a list and a tuple?
A Python Developer was asked 7mo agoQ3. What is a namespace and what are its types?
Accenture Python Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits