#Getting input for array from userfrom array import*
a = array("i",[])
n =int(input("Enter the length of array "))for i inrange(n):
x =int(input("Enter the next value "))
a.append(x)print(a)
#python arrays#arrays can be defined in the following # class array.array(typecode[, initializer])# The typecode character used to create the array eg i for integers , c for strings etch
array = array('i',[1,2,3,100,4,4,5,20,20,20])#You can perform serveral methods eg remove(),pop()#removing the last element in the array
array.pop()#Adding elements to array using the append and insert method
array.append(20)
array.insert(4,100)#adds 100 at index 4
#in python we consider lists to be arrays
MyArray =["Kathmandu","Bardaghat","Butwal","Biratnagar"]#array of places of Nepal#we can print it by print(MyArray)
# In python, arrays are actually called lists. Same thing tho
list_or_array =[1.0,2,'3',True,[1,2,3,4]]"""
So, list can contain floats, integers, strings, booleans, nested lists, and
practically any other datatype
"""
array =[2,54,5,7,8,9]#printing wole arrayprint(array)#it will print whole array#printing any one array will be like thisprint(array[0])#it will print 2print(array[2])#it will print 5print(array[1])#it will print 54#and so on...
1. Use the same email address that you used while registering for this opportunity.2. Please mention the details properly.3. There is Negative Marking forall the questions(MCQ & Output)in the Aptitude Section(+2for right answer and-1for wrong answer).4. In the Technical Section there is Negative Marking incase of MCQ questions(+2for right answer and-1for wrong answer)and no Negative Marking incase of Output questions.5. Please specify the exact answers / outputs incase of Short Answers with the exact casing, spaces, etc as it should be. You can assume that the answers are checked using the string compare function.
# Python program to demonstrate# Creation of Array# importing "array" for array creationsimport array as arr
# creating an array with integer type
a = arr.array('i',[1,2,3])# printing original arrayprint("The new created array is : ", end =" ")for i inrange(0,3):print(a[i], end =" ")print()# creating an array with float type
b = arr.array('d',[2.5,3.2,3.3])# printing original arrayprint("The new created array is : ", end =" ")for i inrange(0,3):print(b[i], end =" ")