How do you make an array in Python?



How do you make an array in Python?..

Answer / chaitanya

The array module contains methods for creating arrays of fixed types with homogeneous data types. Arrays are slower then list.

Array of characters, integers, floating point numbers can be created using array module.

array(typecode[, intializer])

Returns a new array whose items are constrained by typecode, and initialized from the optional initialized value. Where the typecode can be for instance ‘c’ for character value, ‘d’ for double, ‘f’ for float.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Is set nesting implemented in python?

0 Answers  


How variables are declared in python?

0 Answers  


What is step size in python?

0 Answers  


How will you capitalize the first letter of string?

3 Answers  


When should you use the “break” in python?

0 Answers  


What is the difference between a shallow copy and deep copy?

0 Answers  


What is data type in python?

0 Answers  


Under what circumstances would von use a while statement rather than for?

0 Answers  


How to call a function of a module by using its name (a string)?

0 Answers  


Is python easy to learn if you know c++?

0 Answers  


Is pypy faster than python?

0 Answers  


How do you handle exceptions with try/except/finally in python?

0 Answers  


Categories