Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Python Program to check whether any number is repeated in Enterd List or not.

PYTHON PROGRAM



a=[]


n=int(input("Enter size of Array:"))


print ("\nEnter",n,"elements in Array:")


flag=0


for i in range(n):


    a.append(int(input()))


for i in range(n):


    for j in range(i+1,n):


        if a[i]>a[j]:


            a[i]=a[i]+a[j]


            a[j]=a[i]-a[j]


            a[i]=a[i]-a[j]


for i in range (n):


    for j in range(i+1,n):


        if a[i]==a[j]:


            flag=1


            temp=a[i]


            break


if flag==1:


            print ("Element",temp,"is repeated in Array.")


else:


            print ("No any Element in Array is repeated")




           

            *** Input && Output ***





        

No comments:

Post a Comment

let me know which type examples you want to comment me.