Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d6cea7c
Delete file Untitled.
Ste452 Jan 8, 2024
219234c
Finished topics of dictionaries
Ste452 Jan 9, 2024
6ca7d92
A some modifications in dictionaries
Ste452 Jan 10, 2024
59113c7
A some modifications about set.
Ste452 Jan 11, 2024
3230a98
Finished first exercise
Ste452 Jan 13, 2024
61f8b61
Exercise Set manipulation in Python
Ste452 Jan 14, 2024
72964e4
Operations with Sets in Python
Ste452 Jan 15, 2024
3b1ab36
Other Functions and Methods
Ste452 Jan 16, 2024
b438e7f
Exercise with other functions and methods on set concepts in Python.
Ste452 Jan 17, 2024
f91b81d
Imutabilidade e Frozensets
Ste452 Jan 21, 2024
647e9ea
Limitations of a set
Ste452 Jan 22, 2024
54a9b4d
Resolving a some works
Ste452 Jan 25, 2024
8201d97
Finished an exercise about set Limitations in Python
Ste452 Feb 5, 2024
4c2f114
Finished first exercise Number Analysis
Ste452 Feb 6, 2024
a4d8357
Finished class about Set and init class Matrices
Ste452 Feb 11, 2024
f0070f3
(1 topic of matrices) Initializing the two matrices and the result ma…
Ste452 Feb 13, 2024
371bec3
Sum of Even Numbers in a 4x4 Matrix
Ste452 Feb 15, 2024
923916c
Finished Matrices and Average of Grades
Ste452 Feb 19, 2024
c64f83e
Array of strings
Ste452 Feb 20, 2024
46b67ac
Exercise - Electronic Urn with Matrices
Ste452 Mar 7, 2024
bc22996
Exercise: Reserve Cinema Seats using Arrays
Ste452 Mar 7, 2024
679f646
Finished a program of Tic-tac-toe.
Ste452 Mar 14, 2024
64770ff
Finished simulate exercise people routine
Ste452 Apr 20, 2024
5759b7d
Methods Defining and calling methods of a class
Ste452 Jul 11, 2024
13b5792
Pet exercise
Ste452 Jul 24, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Operations with Sets in Python
  • Loading branch information
Ste452 committed Jan 15, 2024
commit 72964e418dff4600b03ba3c85be0d6507cc3ac12
39 changes: 22 additions & 17 deletions 1_section_Programming_logic/Set+(Conjuntos).ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "4db52201",
"metadata": {},
"outputs": [
Expand All @@ -476,18 +476,11 @@
"output_type": "stream",
"text": [
"{'pássaro', 'cachorro', 'gato'}\n",
"{'pássaro', 'cachorro', 'gato', 'peixe'}\n"
]
},
{
"ename": "TypeError",
"evalue": "set.discard() takes exactly one argument (0 given)",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[1], line 85\u001b[0m\n\u001b[0;32m 76\u001b[0m \u001b[38;5;66;03m#animais.remove(\"lagarto\")\u001b[39;00m\n\u001b[0;32m 77\u001b[0m \u001b[38;5;66;03m#print(animais)\u001b[39;00m\n\u001b[0;32m 79\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 80\u001b[0m \u001b[38;5;124;03m4. Usando discard():\u001b[39;00m\n\u001b[0;32m 81\u001b[0m \u001b[38;5;124;03m Descarte \"lagarto\" do conjunto usando discard(). Observe o que acontece.\u001b[39;00m\n\u001b[0;32m 82\u001b[0m \u001b[38;5;124;03m Imprima o conjunto atualizado.\u001b[39;00m\n\u001b[0;32m 83\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m---> 85\u001b[0m animais\u001b[38;5;241m.\u001b[39mdiscard()\n\u001b[0;32m 86\u001b[0m \u001b[38;5;28mprint\u001b[39m(animais)\n\u001b[0;32m 88\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 89\u001b[0m \u001b[38;5;124;03m5. Usando pop():\u001b[39;00m\n\u001b[0;32m 90\u001b[0m \u001b[38;5;124;03m Use o método pop() para remover um elemento aleatório do conjunto \u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 93\u001b[0m \u001b[38;5;124;03m Imprima o conjunto atualizado.\u001b[39;00m\n\u001b[0;32m 94\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n",
"\u001b[1;31mTypeError\u001b[0m: set.discard() takes exactly one argument (0 given)"
"{'pássaro', 'cachorro', 'gato', 'peixe'}\n",
"{'cachorro', 'gato', 'peixe'}\n",
"Animal removido: cachorro\n",
"{'gato', 'peixe'}\n",
"set()\n"
]
}
],
Expand Down Expand Up @@ -576,7 +569,8 @@
" Imprima o conjunto atualizado.\n",
"\"\"\"\n",
"\n",
"animais.discard()\n",
"animais.discard(\"lagarto\")\n",
"print(animais)\n",
"\n",
"\"\"\"\n",
"5. Usando pop():\n",
Expand Down Expand Up @@ -1685,11 +1679,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "261f3b72",
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"baz\n"
]
}
],
"source": [
"x = [10, [3.141, 20, [30, \"baz\", 2.718]], \"foo\"]\n",
"print(x[1][2][1])"
]
}
],
"metadata": {
Expand Down