... | @@ -111,7 +111,7 @@ TBW |
... | @@ -111,7 +111,7 @@ TBW |
|
This section is based on [notes from CS 330 Object Oriented Programming & Design](https://www.cs.odu.edu/~tkennedy/cs330/f20/Public/switchingToPython/index.html).
|
|
This section is based on [notes from CS 330 Object Oriented Programming & Design](https://www.cs.odu.edu/~tkennedy/cs330/f20/Public/switchingToPython/index.html).
|
|
|
|
|
|
|
|
|
|
# # Data Structures
|
|
# Data Structures
|
|
|
|
|
|
When I work in Python, I generally focus on three core (fundamental) data
|
|
When I work in Python, I generally focus on three core (fundamental) data
|
|
structures.
|
|
structures.
|
... | @@ -163,7 +163,7 @@ approach: |
... | @@ -163,7 +163,7 @@ approach: |
|
|
|
|
|
and translate it into Python:
|
|
and translate it into Python:
|
|
|
|
|
|
> ** Word Count - Boring Python Loop**
|
|
> **Word Count - Boring Python Loop**
|
|
>
|
|
>
|
|
> ```python
|
|
> ```python
|
|
> def main():
|
|
> def main():
|
... | @@ -219,8 +219,8 @@ appropriate: |
... | @@ -219,8 +219,8 @@ appropriate: |
|
Modern C++11 and newer provide the `std::transform` method. Combined with
|
|
Modern C++11 and newer provide the `std::transform` method. Combined with
|
|
`lambda functions` we can take the original C++ code... and rewrite it as
|
|
`lambda functions` we can take the original C++ code... and rewrite it as
|
|
|
|
|
|
**Word Count - C++ `std::transform`**
|
|
> **Word Count - C++ `std::transform`**
|
|
|
|
>
|
|
> ```c++
|
|
> ```c++
|
|
> using std::string;
|
|
> using std::string;
|
|
> using std::vector;
|
|
> using std::vector;
|
... | | ... | |