Skip to content

Commit c514648

Browse files
Merge pull request #2 from MathMachado/master
NB_06_actuliza
2 parents 5d531e9 + 4b7419f commit c514648

2 files changed

Lines changed: 2396 additions & 28 deletions

File tree

Notebooks/NB06_02__List_Comprehension.ipynb

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"colab_type": "text"
8888
},
8989
"source": [
90+
"___\n",
9091
"# Python Lists Comprehension\n",
9192
"\n",
9293
"Sintaxe básica:\n",
@@ -137,7 +138,7 @@
137138
"colab_type": "code",
138139
"colab": {
139140
"base_uri": "https://localhost:8080/",
140-
"height": 35
141+
"height": 34
141142
},
142143
"outputId": "7f8f2f47-009a-4e17-b8a0-f36ad8219355"
143144
},
@@ -171,7 +172,7 @@
171172
"import numpy as np\n",
172173
"\n",
173174
"np.random.seed(20111974)\n",
174-
"l_FloatNumbers= [np.random.random() for _ in range(5)]"
175+
"l_FloatNumbers= [np.random.randint(0, 10) for _ in range(5)]"
175176
],
176177
"execution_count": 0,
177178
"outputs": []
@@ -181,32 +182,28 @@
181182
"metadata": {
182183
"id": "giOtZF37MeIv",
183184
"colab_type": "code",
184-
"outputId": "f1d9984f-e495-477f-9a4d-6b300ca56ef2",
185+
"outputId": "d5894cc4-ba0a-40f0-a47f-3c307c15c6e7",
185186
"colab": {
186187
"base_uri": "https://localhost:8080/",
187-
"height": 101
188+
"height": 34
188189
}
189190
},
190191
"source": [
191192
"l_FloatNumbers"
192193
],
193-
"execution_count": 0,
194+
"execution_count": 7,
194195
"outputs": [
195196
{
196197
"output_type": "execute_result",
197198
"data": {
198199
"text/plain": [
199-
"[0.5309723295184019,\n",
200-
" 0.569656260808191,\n",
201-
" 0.5425293780522449,\n",
202-
" 0.6547840853457134,\n",
203-
" 0.8570845590847208]"
200+
"[8, 8, 2, 8, 9]"
204201
]
205202
},
206203
"metadata": {
207204
"tags": []
208205
},
209-
"execution_count": 4
206+
"execution_count": 7
210207
}
211208
]
212209
},
@@ -225,7 +222,7 @@
225222
"metadata": {
226223
"id": "tANHZTvzP0JT",
227224
"colab_type": "code",
228-
"outputId": "fb45b38a-25e0-48e4-9e63-72d10059875d",
225+
"outputId": "689fd6d1-9578-4087-e80b-cc8714856916",
229226
"colab": {
230227
"base_uri": "https://localhost:8080/",
231228
"height": 34
@@ -240,7 +237,7 @@
240237
"\n",
241238
"print(l_Quadrado)"
242239
],
243-
"execution_count": 0,
240+
"execution_count": 8,
244241
"outputs": [
245242
{
246243
"output_type": "stream",
@@ -314,7 +311,6 @@
314311
"source": [
315312
"l_Lista_A = [1, 2, 3, 4]\n",
316313
"l_Lista_B = [2, 3, 4, 5]\n",
317-
"\n",
318314
"l_Comum = []\n",
319315
"\n",
320316
"for x in l_Lista_A:\n",
@@ -350,7 +346,7 @@
350346
"metadata": {
351347
"id": "mNt-OixCQ1Bg",
352348
"colab_type": "code",
353-
"outputId": "eff9e1fd-27cf-4480-df34-f46569907bbd",
349+
"outputId": "f187556a-184d-4f15-e94c-ee4d0ddf99a9",
354350
"colab": {
355351
"base_uri": "https://localhost:8080/",
356352
"height": 34
@@ -361,10 +357,9 @@
361357
"l_Lista_B = [2, 3, 4, 5]\n",
362358
"\n",
363359
"l_Comum = [x for x in l_Lista_A for y in l_Lista_B if x == y]\n",
364-
"\n",
365360
"print(l_Comum)"
366361
],
367-
"execution_count": 0,
362+
"execution_count": 9,
368363
"outputs": [
369364
{
370365
"output_type": "stream",
@@ -630,7 +625,7 @@
630625
"metadata": {
631626
"id": "ErZoaMpe5mgE",
632627
"colab_type": "code",
633-
"outputId": "78cc4602-20f0-4bad-82de-a3ce1af72fb9",
628+
"outputId": "97745ea1-75ee-49da-e33f-dfd052cab4b1",
634629
"colab": {
635630
"base_uri": "https://localhost:8080/",
636631
"height": 34
@@ -643,9 +638,9 @@
643638
"\n",
644639
"np.random.seed(20111974)\n",
645640
"l_Fahrenheit= [np.random.randint(10, 80, 10)]\n",
646-
"l_Farenheit"
641+
"l_Fahrenheit"
647642
],
648-
"execution_count": 0,
643+
"execution_count": 11,
649644
"outputs": [
650645
{
651646
"output_type": "execute_result",
@@ -657,7 +652,7 @@
657652
"metadata": {
658653
"tags": []
659654
},
660-
"execution_count": 25
655+
"execution_count": 11
661656
}
662657
]
663658
},
@@ -666,17 +661,17 @@
666661
"metadata": {
667662
"id": "MetowzHE5fYS",
668663
"colab_type": "code",
669-
"outputId": "8449425f-2ce8-46a0-b120-d5f28d1ead5f",
664+
"outputId": "25b50020-04e1-4fc2-b670-a43626e2c3b4",
670665
"colab": {
671666
"base_uri": "https://localhost:8080/",
672667
"height": 67
673668
}
674669
},
675670
"source": [
676-
"l_Celsius= [(x-32)*(5/9) for x in l_Farenheit]\n",
671+
"l_Celsius= [(x-32)*(5/9) for x in l_Fahrenheit]\n",
677672
"l_Celsius"
678673
],
679-
"execution_count": 0,
674+
"execution_count": 12,
680675
"outputs": [
681676
{
682677
"output_type": "execute_result",
@@ -690,7 +685,7 @@
690685
"metadata": {
691686
"tags": []
692687
},
693-
"execution_count": 26
688+
"execution_count": 12
694689
}
695690
]
696691
},
@@ -778,7 +773,7 @@
778773
"metadata": {
779774
"id": "LX7oPa2L-lkK",
780775
"colab_type": "code",
781-
"outputId": "703f76f8-55c0-48b7-c0e0-8dfecb0f5894",
776+
"outputId": "f0cff845-3077-4e4f-9740-b04c4975c27b",
782777
"colab": {
783778
"base_uri": "https://localhost:8080/",
784779
"height": 34
@@ -787,7 +782,7 @@
787782
"source": [
788783
"[(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]"
789784
],
790-
"execution_count": 0,
785+
"execution_count": 13,
791786
"outputs": [
792787
{
793788
"output_type": "execute_result",
@@ -799,7 +794,7 @@
799794
"metadata": {
800795
"tags": []
801796
},
802-
"execution_count": 28
797+
"execution_count": 13
803798
}
804799
]
805800
},

0 commit comments

Comments
 (0)