Skip to content

Commit 688b7d5

Browse files
authored
Update README.md
1 parent d82d33d commit 688b7d5

File tree

1 file changed

+141
-1
lines changed

1 file changed

+141
-1
lines changed
Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,141 @@
1-
0x03-python-data_structures
1+
# Python Data structures
2+
3+
In this project i learnt sequence data types work in
4+
Python - specifically; lists and tuples.
5+
6+
I also learnt about:
7+
8+
* What are lists and how to use them
9+
* What are the differences and similarities between strings and lists
10+
What are the most common methods of lists and how to use them
11+
How to use lists as stacks and queues
12+
What are list comprehensions and how to use them
13+
What are tuples and how to use them
14+
When to use tuples versus lists
15+
What is a sequence
16+
What is tuple packing
17+
What is sequence unpacking
18+
What is the del statement and how to use it
19+
20+
## Function Prototypes :floppy_disk:
21+
22+
Prototypes for functions written in this project:
23+
24+
| File | Prototype |
25+
| ---------------------------------- | ---------------------------------------------- |
26+
| `0-print_list_integer.py` | `def print_list_integer(my_list=[]):` |
27+
| `1-element_at.py` | `def element_at(my_list, idx):` |
28+
| `2-replace_in_list.py` | `def replace_in_list(my_list, idx, element):` |
29+
| `3-print_reversed_list_integer.py` | `def print_reversed_list_integer(my_list=[]):` |
30+
| `4-new_in_list.py` | `def new_in_list(my_list, idx, element):` |
31+
| `5-no_c.py` | `def no_c(my_string):` |
32+
| `6-print_matrix_integer.py` | `def print_matrix_integer(matrix=[[]]):` |
33+
| `7-add_tuple.py` | `def add_tuple(tuple_a=(), tuple_b=()):` |
34+
| `8-multiple_returns.py` | `def multiple_returns(sentence):` |
35+
| `9-max_integer.py` | `def max_integer(my_list=[]):` |
36+
| `10-divisible_by_2.py` | `def divisible_by_2(my_list=[]):` |
37+
| `11-delete_at.py` | `def delete_at(my_list=[], idx=0):` |
38+
| `100-print_python_list_info.c` | `void print_python_list_info(PyObject *p);` |
39+
40+
## Tasks:
41+
42+
```
43+
44+
* **0. Print a list of integers**
45+
* [0-print_list_integer.py](./0-print_list_integer.py): Python function that prints all
46+
integers of a list, one per line.
47+
* Without importing modules or casting integers into strings.
48+
49+
* **1. Secure access to an element in a list**
50+
* [1-element_at.py](./1-element_at.py): Python function that retrieves an element
51+
from a list.
52+
* If `idx` is negative or out of range (greater than the number of elements in
53+
`my_list`), the function returns `None`.
54+
* Without import modules or using `try/except`.
55+
56+
* **2. Replace element**
57+
* [2-replace_in_list.py](./2-replace_in_list.py): Python function that replaces an element
58+
of a list at a specific position.
59+
* If `idx` is negative or out of range (greater than the number of elements
60+
in `my_list`), the function returns the original list.
61+
* Without importing modules or using `try/except`.
62+
63+
* **3. Print a list of integers... in reverse!**
64+
* [3-print_reversed_list_integer.py](./3-print_reversed_list_integer.py): Python
65+
function that prints all integers of a list, one per line, in reverse order.
66+
* Without importing modules or casting integers into strings.
67+
68+
* **4. Replace in a copy**
69+
* [4-new_in_list.py](./4-new_in_list.py): Python function that replaces an element of a
70+
list at a specific position without modifying the original list.
71+
* If `idx` is negative or out of range (greater than the number of elements in
72+
`my_list`), the function returns the original list.
73+
* Without importing modules or using `try/except`.
74+
75+
* **5. Can you C me now?**
76+
* [5-no_c.py](./5-no_c.py): Python function that removes all characters `c`
77+
and `C` from a string and returns the string.
78+
* Without importing modules or using `str.replace()`.
79+
80+
* **6. Lists of lists = Matrix**
81+
* [6-print_matrix_integer.py](./6-print_matrix_integer.py): Python function that prints
82+
a matrix of integers, one row per line.
83+
* Without casting integers into strings.
84+
85+
* **7. Tuples addition**
86+
* [7-add_tuple.py](./7-add_tuple.py): Python function that adds two tuples.
87+
* Returns a tuple with two integers:
88+
* The first element is the addition of the first element of each argument.
89+
* The second element is the addition of the second element of each argument.
90+
* If a tuple is smaller than 2, the value `0` is used for the missing integer.
91+
* If a tuple is larger than 2, only the first two integers are used.
92+
* Without importing modules.
93+
94+
* **8. More returns!**
95+
* [8-multiple_returns.py](./8-multiple_returns.py): Python function that returns a
96+
tuple with the length of a string and its first character.
97+
* If the string is empty, the first character should equal `None`.
98+
* Without importing modules.
99+
100+
* **9. Find the max**
101+
* [9-max_integer.py](./9-max_integer.py): Python function that finds the biggest integer
102+
of a list.
103+
* If the list is empty, the function returns `None`.
104+
* Without importing modules or using the builtin `max()`.
105+
106+
* **10. Only by 2**
107+
* [10-divisible_by_2.py](./10-divisible_by_2.py): Python function that finds all multiples
108+
of 2 in a list. * Returns a new list of the same size. Each element of the new
109+
list contains either `True` or `False` corresponding to whether the integer at
110+
the same position in the original list is a multiple of 2.
111+
* Without importing modules.
112+
113+
* **11. Delete at**
114+
* [11-delete_at.py](./11-delete_at.py): Python function that deletes an item at
115+
a specific position in a list.
116+
* If `idx` is negative or out of range (greater than the number of elements in
117+
`my_list`), the function returns the original list.
118+
* Without imporitng modules or using `pop()`.
119+
120+
* **12. Switch**
121+
* [12-switch.py](./12-switch.py): Python program that switches the values of
122+
variable `a` and `b`.
123+
* Completion of [this source code](https://github.com/holbertonschool/0x03.py/blob/master/12-switch_py).
124+
125+
* **13. Linked list palindrome**
126+
* [13-is_palindrome.c](./13-is_palindrome.c): C function that checks if a
127+
singly-linked list is a palindrome.
128+
* If the function is not a palindrome - returns `0`.
129+
* If the function is a palindrome - returns `1`.
130+
* An empty list is considered a palindrome.
131+
* Helper files:
132+
* [linked_lists.c](./linked_lists.c): C functions handling linked lists for
133+
testing [13-is_palindrome.c](./13-is_palindrome.c) (provided by Holberton School).
134+
* [lists.h](./lists.h): Header file containing definitions and prototypes for all types
135+
and functions used in [linked_lists.c](./linked_lists.c) and
136+
[13-insert_number.c](./13-insert_number.c).
137+
138+
* **14. CPython #0: Python lists**
139+
* [100-print_python_list_info.c](./100-print_python_list_info.c): C function that
140+
prints basic information about Python lists.
141+
```

0 commit comments

Comments
 (0)