From a96ed8e797a51fdef536f2e7edcf2b90c5985cc6 Mon Sep 17 00:00:00 2001 From: Joe Roland Date: Mon, 14 Jan 2019 21:11:06 -0500 Subject: [PATCH] Fix: Fixed formatting issues and broken links (#28930) --- .../miscellaneous/data-structure-arrays/index.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/guide/english/miscellaneous/data-structure-arrays/index.md b/guide/english/miscellaneous/data-structure-arrays/index.md index cc2af69723..555323962d 100644 --- a/guide/english/miscellaneous/data-structure-arrays/index.md +++ b/guide/english/miscellaneous/data-structure-arrays/index.md @@ -11,7 +11,7 @@ C++ provides a data structure, `array`, which stores a fixed-size sequential col #### Declaration of `array` - int intarray10]; // Declares an array of integer type of size 10 with elements having random values. Index ranges from 0 to 9(i.e. size-1). + int intarray[10]; // Declares an array of integer type of size 10 with elements having random values. Index ranges from 0 to 9(i.e. size-1). int intarray[10] = { 0 }; // Declares an array of integer of size 10 with all elements having value 0 // Choose one the two declarations and then move ahead. @@ -38,7 +38,13 @@ C++ provides a data structure, `array`, which stores a fixed-size sequential col std::cout << sizeof(intarray)/sizeof(intarray[0]) << std::endl; // Returns the length of the array i.e. 10. std::cout << sizeof(intarray[0]) << std::endl; // Returns length in bytes of one array item i.e. 4 as it is an integer -:rocket: [Run Code ## Arrays in Python Python doesn't have a native `array` data structure. An `array` in Python should not be confused with `list`. The major difference between a `list` and an `array` in Python is that a `list` can have different types of values whereas an `array` should have all the values of same type. #### Declaration of `array` +:rocket: [Run Code](https://repl.it/CWZE/3) + +## Arrays in Python + +Python doesn't have a native `array` data structure. An `array` in Python should not be confused with `list`. The major difference between a `list` and an `array` in Python is that a `list` can have different types of values whereas an `array` should have all the values of same type. + +#### Declaration of `array` from array import array intarray = array('i') # Declares an array of integer type @@ -76,6 +82,6 @@ C++ provides a data structure, `array`, which stores a fixed-size sequential col intarray.reverse() # Reverse the order of the items in the array intarray.pop(1) # Removes the item with the index 1 from the array and returns it -![:rocket:](//forum.freecodecamp.com/images/emoji/emoji_one/rocket.png?v=2 ":rocket:") Run Code +:rocket: [Run Code](https://repl.it/CWJB) -Official Docs \ No newline at end of file +Official Docs