Python Program To Print Every Index of Duplicate Elements in List

  Рет қаралды 57,707

Amulya's Academy

Amulya's Academy

Күн бұрын

Пікірлер
@pavankumarlucky5963
@pavankumarlucky5963 3 жыл бұрын
for multiple duplicate elements: num=int(input()) l=[int(input()) for i in range(num)] orig=[] dup=[] for i in l: if i not in orig: orig.append(i) else: dup.append(i) print(l) print(orig) print(dup)
@Abkklp
@Abkklp 2 жыл бұрын
Dear sister your effort are very special. God bless you
@rahatsshowcase8614
@rahatsshowcase8614 3 жыл бұрын
i was building a massive python bot and stuck in this simple algorithm!! XD But thanks sister! For Saving my time !!
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Pleasure 😊
@tesfalemhaile8427
@tesfalemhaile8427 5 жыл бұрын
I really look forward to your videos as I think you're method of teaching is really good. Keep up , and please make video about Archive fils THANK YOU
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@technoinfoworldwide2329
@technoinfoworldwide2329 4 жыл бұрын
i am quarantine at home, and next semester is my intern..so utilizing the time looking this type of your video..subscribed..make more video mam
@shohailaamil1238
@shohailaamil1238 4 жыл бұрын
Similar to me
@sujalgandha1325
@sujalgandha1325 3 жыл бұрын
You are teaching very good.Can you make video for this question: Write user defined function to show scope of global and local variables. In python.
@pedrocastro882
@pedrocastro882 3 жыл бұрын
thank you so much you saved my project
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Glad to hear that :)
@Kavithaofficial2004
@Kavithaofficial2004 2 жыл бұрын
Nice it's really helpful and understandable...அருமை✨☺️
@jeevatamilan9777
@jeevatamilan9777 5 жыл бұрын
Wow amazing superb your explanation is very clear👏👏👏
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@Just_Code444
@Just_Code444 Жыл бұрын
Thanks a lot for the explanation
4 жыл бұрын
you are genius
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Thank you :)
@shiningcopper
@shiningcopper 3 жыл бұрын
beautiful and simple. just two lines.
@AmulsAcademy
@AmulsAcademy 3 жыл бұрын
Thank you :)
@monoranjanchakraborty1279
@monoranjanchakraborty1279 5 жыл бұрын
mam your are really good
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@jaiprasadkowru1322
@jaiprasadkowru1322 Жыл бұрын
Thanks ❤
@saurabhamrutkar3497
@saurabhamrutkar3497 2 жыл бұрын
can you please tell, How to perform same operation for nested in list...?
@buvaneshkumar5626
@buvaneshkumar5626 4 жыл бұрын
I see you're hard coding the repeated element in the code. But in most cases, we won't be knowing what was the repeated element.
@vasundharajayswal5451
@vasundharajayswal5451 3 жыл бұрын
def dup_elmnt(list1): indx_list=[] temp=[] for j in list1: if list1.count(j)>=2 and j not in temp: for i in range(len(list1)): if list1[i]==j: indx_list.append(i) temp.append(j) else: pass return indx_list
@sasidharreddy5008
@sasidharreddy5008 6 ай бұрын
Here you know the duplicate values and you added them in the if condition and got those indexes what if you dont the elements which got duplicated in such cases how to do.?
@minalhombre6821
@minalhombre6821 4 жыл бұрын
Thank you.
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
You're welcome! :)
@sahiltikku6970
@sahiltikku6970 5 жыл бұрын
You are good
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
@Leo197999
@Leo197999 3 жыл бұрын
Thank you!!!
@kerubananthang2985
@kerubananthang2985 2 жыл бұрын
Is it possible to print the multiple duplicate element's index at same time??
@eswarkalakata5183
@eswarkalakata5183 4 жыл бұрын
#finding the index for diplicate eliments l = [1,2,3,3,1,0,1] count = 0 s = set() v = [] for indx,value in enumerate(l): if value not in s: s.add(value) else: v.append([value,indx]) print(v)
@javierLopez-zb3oe
@javierLopez-zb3oe 4 жыл бұрын
Is there a super efficient way to do this? I tried with panda and it takes about the same time. I'm dealing with lists of 100k elements. Any advice? I'd really appreciate it! Thanks!
@daveclosinger6697
@daveclosinger6697 4 жыл бұрын
Find them by hand manually
@ahsanmomin4110
@ahsanmomin4110 Жыл бұрын
names=['alex','hannahe','james'] Find how many 'e' and 'a' are there in list output [2,3,2] How to solve this one please asist??
@yukeshteach1181
@yukeshteach1181 3 ай бұрын
l1=["alex","hannahe","james"] #to find out no of and e l2=[] a="" count=0 for i in range(0,len(l1)): a=l1[i] count=0 for j in range(0,len(a)): if a[j]=='a'or a[j]=='e': count=count+1 l2.append(count) print(l2)
@Pardhu-g5g
@Pardhu-g5g 3 ай бұрын
nice question osm
@bhavanapanwar9258
@bhavanapanwar9258 4 жыл бұрын
thnq ...
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
Welcome :)
@rajeshs2840
@rajeshs2840 5 жыл бұрын
This code will give index of non duplicate numbers also. Sloppy code
@keshavmittal6365
@keshavmittal6365 5 жыл бұрын
Mam how can we make similar program when we input the list values from user and we don't know the repeated values
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
n = int(input("How many elements you want in list:")) list1 = [] for i in range(n): list1.append(eval(input())) print("input list is:",list1) elem = eval(input("select the element: ")) list2 = [i for i in range(len(list1)) if list1[i]==elem] print("index of",elem,"is:",list2) :)
@keshavmittal6365
@keshavmittal6365 5 жыл бұрын
@@AmulsAcademy thank you
@CrazyFunCricket
@CrazyFunCricket 3 жыл бұрын
you have hardcoded the 1 its bad
@harpreetsidhu606
@harpreetsidhu606 4 жыл бұрын
i know that we can know the first occurence of the element by index method in lists,but can we do this same with because sets are unordered and unchangeable sometimes it prints only duplicate elements or without duplicate elements.like union( ) and update method exclude duplicate elements.
@neetuchauhan3137
@neetuchauhan3137 5 жыл бұрын
nice please tell me that which is the best laptop for programming and hacking
@archu68
@archu68 4 жыл бұрын
Can u make a program in python to check is user name valid or not
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
I will try :)
@abdulhaleem7886
@abdulhaleem7886 5 жыл бұрын
helloo.. can we add else statement to the above code??
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Yes :)
@keishalorejo7217
@keishalorejo7217 3 жыл бұрын
how do you do this in java?
@harpreetsidhu606
@harpreetsidhu606 4 жыл бұрын
also how can i make money from python becouse i know python, java, c#,c++,c as well as javascript html and css(cascading style sheets).what can i do for passive income
@karuma.-7618
@karuma.-7618 4 жыл бұрын
Work for google, or big companies that require such skills, most pay a huge salary, especially in the medical field.
@omsrisaikrishna9618
@omsrisaikrishna9618 5 жыл бұрын
Please tell me, how it will be compiler run step by step
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
That program will print all the index of given duplicate element in list. 1 take a list with duplicate values. 2. we are using list comprehension method, i for i in range(len(list1)) ---------------------> it will print all the index of list element. but we want index of particular duplicate element, for example 1. so i will take if list1[i] == 1 condition. so it will give all the index duplicate element 1. 3 .next we will print that. :)
@omsrisaikrishna9618
@omsrisaikrishna9618 5 жыл бұрын
@@AmulsAcademy thank you
@kabeerbasha326
@kabeerbasha326 4 жыл бұрын
hello every one i have a number = 963 but i want output like this 18 is it possible
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
num = int(input("num:")) result=0 str_num = str(num) for i in str_num: result = result+int(i) print(result) :)
@kabeerbasha326
@kabeerbasha326 4 жыл бұрын
@@AmulsAcademy Thank you so much Amuls :)
@swapnilw.
@swapnilw. 3 жыл бұрын
@@AmulsAcademy wow first 2 min. i didnt understand
@malikshehryar696
@malikshehryar696 5 жыл бұрын
please do this for gerenal code
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
It will work for any list. If you want to take user entered list then, instead of taking list directly take like this. num = int(input("enter the list length:")) list1 = [int(input()) for i in range(num)] :)
@kennethdomingo3681
@kennethdomingo3681 4 жыл бұрын
List1 = [ken, di, py] #firstname List2 = [py, thon, prog] #lastname List2 = [3,3,1] #grades How to get the max or min grades with getting the parralel index of list 1 and list2 My prob is only 0 index is readable But i need output is Ken py 3 Di thon 3
@technicalanalytics1391
@technicalanalytics1391 4 жыл бұрын
Second Maximum Number in a List Description Given a list of numbers, find the second largest number in the list. Note: There might be repeated numbers in the list. If there is only one number present in the list, return 'not present'. Examples: Input 1: [7, 2, 0, 9, -1, 8] Output 1: 8 Input 2: [3, 1, 4, 4, 5, 5, 5, 0, 2, 2] Output 2: 4 Input 2: [6, 6, 6, 6, 6] Output 2: not present can you explain this problem
@AmulsAcademy
@AmulsAcademy 4 жыл бұрын
I will try to make a video on that :)
@mandeepubhi4744
@mandeepubhi4744 5 жыл бұрын
Awesome
@AmulsAcademy
@AmulsAcademy 5 жыл бұрын
Thank you :)
Python Tutorials - int() |  bin() |  oct() | hex()
7:08
Amulya's Academy
Рет қаралды 45 М.
10 Python Comprehensions You SHOULD Be Using
21:35
Tech With Tim
Рет қаралды 157 М.
5 Useful Dunder Methods In Python
16:10
Indently
Рет қаралды 63 М.
Python Program to Remove Duplicate Elements from a List
6:43
Example Program
Рет қаралды 99 М.
Programming Languages Tier List 2024
16:18
Neal Wang
Рет қаралды 10 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 121 М.
why are switch statements so HECKIN fast?
11:03
Low Level
Рет қаралды 427 М.
Python Programs - Factorial Program Using Recursion
18:08
Amulya's Academy
Рет қаралды 75 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 414 М.
How To Use Dunder Methods In Python Tutorial (Magic Methods)
6:36
Python Program To Find out the Maximum Value in Nested List
9:20
Amulya's Academy
Рет қаралды 31 М.