Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions 4.x more x.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def more_then_once(array,x):
flag=False
count=0
for i in array:
if i==x:
count+=1
if count>1:
flag=True
return flag
array=[1,2,3,5,5,6,7,8]
x=input("enter the value:")
print(more_then_once(array,x))
12 changes: 12 additions & 0 deletions 5.x more count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def more_then_once_count(array,x):

count=0
for i in array:
if i==x:
count+=1


return count
array=[1,2,3,5,5,5,5,5,6,7,8]
x=input("enter the value:")
print(more_then_once_count(array,x))
8 changes: 8 additions & 0 deletions 6.sumarray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def sumarray(a):
sum=0
for i in a:
sum+=i

return sum
a=[4,5,7,3,1]
print(sumarray(a))
8 changes: 8 additions & 0 deletions 7.sumarray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def sumarray(a):
sum=0
for i in a:
sum+=i

return sum
a=[4,5,7,3,1]
print(sumarray(a))
11 changes: 11 additions & 0 deletions countarray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

def countarray(a):
count=0

while(a>0):
temp=a%10
count+=1
a=a//10
return count
a=(1234)
print(countarray(a))
10 changes: 10 additions & 0 deletions findxval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def findx(array):
flag=False
for i in array:
if(i==x):
flag=True
return flag
array=[1,3,5,7,9]
x=input("enter the value:")
print(findx(array))

7 changes: 7 additions & 0 deletions lengtn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def arrlen(array):
count=0
for i in array:
count+=1
return count
array=[123,485,345]
print(arrlen(array))