diff --git a/data_structures/2_Arrays/expenses.py b/data_structures/2_Arrays/expenses.py new file mode 100644 index 0000000..9fc1994 --- /dev/null +++ b/data_structures/2_Arrays/expenses.py @@ -0,0 +1,23 @@ +lst= [2200,2350,2600,2130,2190] + + +# 1 +print(f"${lst[1] - lst[0]}") + +# 2 +print(f"You spent ${lst[0] + lst[1] +lst[2]} ") + +# 3 + + +for expense in lst: + if expense == 2000: + print(expense + " is exactly 2000") + print("month is $2000") + +lst.append(1980) + + +lst[3] = lst[3] - 200 + +print(lst[3]) \ No newline at end of file diff --git a/data_structures/2_Arrays/marvel.py b/data_structures/2_Arrays/marvel.py new file mode 100644 index 0000000..6c7baf3 --- /dev/null +++ b/data_structures/2_Arrays/marvel.py @@ -0,0 +1,26 @@ +heros=['spider man','thor','hulk','iron man','captain america'] + +print(len(heros)) + +heros.append("black panther") + +print(heros) + +heros.remove("black panther") +print(heros) + +heros[3] = "black panther" + +print(heros) + +heros.remove("thor") +heros.remove("hulk") + +print(heros) + +heros.append("doctor strange") + +print(heros) +heros.sort() + +print(heros) \ No newline at end of file diff --git a/data_structures/2_Arrays/odd_even_numbers.py b/data_structures/2_Arrays/odd_even_numbers.py new file mode 100644 index 0000000..ec1c4b7 --- /dev/null +++ b/data_structures/2_Arrays/odd_even_numbers.py @@ -0,0 +1,9 @@ +max = int(input("Enter max number: ")) + +odd_numbers = [] + +for i in range(1, max): + if i % 2 == 1: + odd_numbers.append(i) + +print("Odd numbers: ", odd_numbers)