# What is an "array"?

**URL:** <https://forum.codewithmosh.com/t/what-is-an-array/380>\
**Category:** Python\
**Created:** [October 30, 2020, 3:34pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380 "2020-10-30T15:34:49Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Megha](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/megha/32/1136_2.png) [@Megha](https://forum.codewithmosh.com/u/Megha)\
**Post date:** [October 30, 2020, 3:34pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/1 "2020-10-30T15:34:49Z")

</div>

In the _Complete Python Mastery_ course, I have watched the “arrays” video…  
But I quite didn’t understand it. And I think _Mosh_ didn’t elaborate it much, and so I didn’t understand 😢 what exactly are arrays and how we use them in **PYTHON**

Thank you

---

<div class="post-metadata">

**Author:** ![A100D-JS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/a100d-js/32/8_2.png) [@A100D-JS](https://forum.codewithmosh.com/u/A100D-JS)\
**Post date:** [October 31, 2020, 1:04am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/2 "2020-10-31T01:04:17Z")

</div>

Hi,  
Can you tell me the section and the name of the episode that teaches about array in python course ?

---

<div class="post-metadata">

**Author:** ![Megha](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/megha/32/1136_2.png) [@Megha](https://forum.codewithmosh.com/u/Megha)\
**Post date:** [October 31, 2020, 2:48am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/3 "2020-10-31T02:48:34Z")

</div>

Section: Data Structures  
Video : Arrays

---

<div class="post-metadata">

**Author:** ![A100D-JS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/a100d-js/32/8_2.png) [@A100D-JS](https://forum.codewithmosh.com/u/A100D-JS)\
**Post date:** [October 31, 2020, 4:09am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/5 "2020-10-31T04:09:31Z")

</div>

Sorry, but i don’t have access to that episode and i couldn’t found the array part in youtube 😞

---

<div class="post-metadata">

**Author:** ![Megha](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/megha/32/1136_2.png) [@Megha](https://forum.codewithmosh.com/u/Megha)\
**Post date:** [November 2, 2020, 10:42am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/6 "2020-11-02T10:42:01Z")

</div>

[Watch the video here!](https://drive.google.com/file/d/16FsT5vkWOAbZJ-yuai-0gxekUMWBpk6_/view?usp=sharing)  
I recorded my screen 😅

---

<div class="post-metadata">

**Author:** ![jose\_reano](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jose\_reano](https://forum.codewithmosh.com/u/jose_reano)\
**Post date:** [November 2, 2020, 9:36pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/7 "2020-11-02T21:36:11Z")

</div>

Hi Megha, I suggest you to visit this link, [https://www.thoughtco.com/definition-of-arrays-in-mathematics-2312362](https://www.thoughtco.com/definition-of-arrays-in-mathematics-2312362)  
it is going to help you,

Regards,

Jose

---

<div class="post-metadata">

**Author:** ![A100D-JS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/a100d-js/32/8_2.png) [@A100D-JS](https://forum.codewithmosh.com/u/A100D-JS)\
**Post date:** [November 2, 2020, 11:38pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/8 "2020-11-02T23:38:35Z")

</div>

Array is a data structure that we use to represent a list of item, but the use case in python is different.  
As mosh said in python we usually use lists but if there is a problem in performance or if we’re dealing with a large list of numbers we use arrays because it takes less memory and has a faster performance.

so he imported **array** class from array **module** and then defined an array which takes two parameters the first one is about the type which can be a short, integer, float, double, long… and the second parameter is the array itself which is a list of items 😞

```
from array import array // so from array module he imported array class

array("i", [1, 2, 3])

```

and after that you can use the methods of that array or you can simply log it using **print**

---

<div class="post-metadata">

**Author:** ![Megha](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/megha/32/1136_2.png) [@Megha](https://forum.codewithmosh.com/u/Megha)\
**Post date:** [November 3, 2020, 5:10am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/9 "2020-11-03T05:10:14Z")

</div>

@jose_reano this is about arrays in mathematics!

---

<div class="post-metadata">

**Author:** ![Zabeite](https://avatars.discourse-cdn.com/v4/letter/z/a9a28c/32.png) [@Zabeite](https://forum.codewithmosh.com/u/Zabeite)\
**Post date:** [November 3, 2020, 8:21am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/10 "2020-11-03T08:21:36Z")

</div>

Hi,  
i got a problem here in Data strurctures, specially in part 1, Tutorial 4(Exercise Array in class), whenever i try to add new item or try to code the Array, this is going to happen

 ![Arrays](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/7d0cab77c031fc86395534ca1cc483c73d9591f1.jpeg)

so please help!  
i have been trying for two days by my self but nothing worked

thanks in advance,  
Sayidali.

---

<div class="post-metadata">

**Author:** ![SAM](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sam/32/167_2.png) [@SAM](https://forum.codewithmosh.com/u/SAM)\
**Post date:** [November 3, 2020, 5:47pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/12 "2020-11-03T17:47:32Z")

</div>

> [@A100D-JS](#):
>
> You have to import `java.lang.Arrays;`

No, you don’t.

@Zabeite First of all: Why are you posting a new _Data Structures_ / _Java_ question in an existing thread in the _Python_ forum?

@Zabeite

- Mosh named the class `Array` while you named it `Arrays`. So the compiler can’t find the `Array` class you try to use in `Main`.

- You seem to have written the parameter names in front of the arguments. Instead of `numbers.Insert(items:10)` just write `numbers.Insert(10)`.

- There are syntax errors in your `Arrays`-class. Fix them before trying to use the class in `Main`.

---

<div class="post-metadata">

**Author:** ![Zabeite](https://avatars.discourse-cdn.com/v4/letter/z/a9a28c/32.png) [@Zabeite](https://forum.codewithmosh.com/u/Zabeite)\
**Post date:** [November 4, 2020, 1:07am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/13 "2020-11-04T01:07:51Z")

</div>

#first I’m sorrey for posting into a different content but, i was only referring to the Arrays which both courses contain.

# although i took every step you mentioned, nothing worked as i expected, am still getiing the same error

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/113c3edcbad687696ac5cd84254b35a0ff32ca8b.png)

---

<div class="post-metadata">

**Author:** ![SAM](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/sam/32/167_2.png) [@SAM](https://forum.codewithmosh.com/u/SAM)\
**Post date:** [November 4, 2020, 5:49am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/14 "2020-11-04T05:49:09Z")

</div>

Look at the lower left window “Build Output”. It lists the errors you need to fix

- don’t type parameter names. It’s `new Array(3) `not `new Array(length:3)`
- you have a superfluous “`.`” in line 7

I’m not sure why your IDE colors the `insert`s in red. Maybe that’s the way it colors method calls, maybe you have a typo in your `Array` class. Look how you spelled `insert` there. Case counts.

---

<div class="post-metadata">

**Author:** ![A100D-JS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/a100d-js/32/8_2.png) [@A100D-JS](https://forum.codewithmosh.com/u/A100D-JS)\
**Post date:** [November 4, 2020, 8:11am UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/15 "2020-11-04T08:11:42Z")

</div>

In line 7 there are 2 dots and you’ve written the length parameter which is not right so you need to just type 10 and the word length will appear with a small grey text.

---

<div class="post-metadata">

**Author:** ![Nazmul](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/nazmul/32/557_2.png) [@Nazmul](https://forum.codewithmosh.com/u/Nazmul)\
**Post date:** [April 6, 2021, 1:19pm UTC](https://forum.codewithmosh.com/t/what-is-an-array/380/16 "2021-04-06T13:19:14Z")

</div>

[Python Arrays](https://shrinke.me/Ubhk)
