+ 1

Python Challenge!

There is an array 'nums' containing 7 integers from 1-6(including 1 and 6). Prove that one of the numbers is duplicate through a bool var 'is duplicate'.. Also tell that which number is the duplicate number. Please tell how to solve this question. My attempt: https://code.sololearn.com/cIbOVp8L8MH7/#py

10th Aug 2020, 4:09 AM
Kunsh-Tyagi
Kunsh-Tyagi - avatar
4 odpowiedzi
+ 7
Kunsh-Tyagi It would be great if you show your attempt! Then we will help you🤝 Asking for readymade question is an offense. Hope you understand 👍
10th Aug 2020, 5:12 AM
Piyush
Piyush - avatar
+ 4
Where is your attemt?
10th Aug 2020, 4:19 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
array.filter(lambda x:array.count(x) >1)
10th Aug 2020, 6:05 AM
Oma Falk
Oma Falk - avatar
+ 2
Oh yeah! thanks for reminding me piyush https://code.sololearn.com/cIbOVp8L8MH7/#py it is saying "Traceback (most recent call last): File "./Playground/file0.py", line 7, in <module> d.append(d.index(x)) ValueError: 1 is not in list "
10th Aug 2020, 7:39 AM
Kunsh-Tyagi
Kunsh-Tyagi - avatar