Skip to content

🐱Add you Programs or projects and experience open source and understand how it works

License

Notifications You must be signed in to change notification settings

saif786123/FunckyLabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python code to demonstrate

searching an element in array

importing array module

import array

initializing array with array values

initializes array with signed integers

arr = array.array('i', [1, 2, 3, 1, 2, 5])

printing original array

print ("The new created array is : ", end ="") for i in range (0, 6): print (arr[i], end =" ")

print ("\r")

using index() to print index of 1st occurrence of 2

print ("The index of 1st occurrence of 2 is : ", end ="") print (arr.index(2))

using index() to print index of 1st occurrence of 1

print ("The index of 1st occurrence of 1 is : ", end ="") print (arr.index(1))

Python program to demonstrate

Creation of Array

importing "array" for array creations

import array as arr

creating an array with integer type

a = arr.array('i', [1, 2, 3])

printing original array

print ("The new created array is : ", end =" ") for i in range (0, 3): print (a[i], end =" ") print()

creating an array with double type

b = arr.array('d', [2.5, 3.2, 3.3])

printing original array

print ("The new created array is : ", end =" ") for i in range (0, 3): print (b[i], end =" ")

About

🐱Add you Programs or projects and experience open source and understand how it works

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11