Skip to content

Commit 4836296

Browse files
committed
Range and lambda
1 parent 4980495 commit 4836296

File tree

2 files changed

+221
-0
lines changed

2 files changed

+221
-0
lines changed

Cap03/Lambda.ipynb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 5
6+
}

Cap03/Range.ipynb

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "8a1b56b6",
6+
"metadata": {},
7+
"source": [
8+
"### Estruturas de Repetição Range\n",
9+
"Repetir um conjunto de elementos um Nº determinado de vezes\n",
10+
"\n",
11+
"#### range([start],[stop],[step]) - o [stop] não é incluso"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 1,
17+
"id": "a5025799",
18+
"metadata": {},
19+
"outputs": [
20+
{
21+
"name": "stdout",
22+
"output_type": "stream",
23+
"text": [
24+
"50\n",
25+
"52\n",
26+
"54\n",
27+
"56\n",
28+
"58\n",
29+
"60\n",
30+
"62\n",
31+
"64\n",
32+
"66\n",
33+
"68\n",
34+
"70\n",
35+
"72\n",
36+
"74\n",
37+
"76\n",
38+
"78\n",
39+
"80\n",
40+
"82\n",
41+
"84\n",
42+
"86\n",
43+
"88\n",
44+
"90\n",
45+
"92\n",
46+
"94\n",
47+
"96\n",
48+
"98\n",
49+
"100\n"
50+
]
51+
}
52+
],
53+
"source": [
54+
"# Imprimindo os números entre 50 e 101\n",
55+
"for i in range(50, 101, 2):\n",
56+
" print(i)"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 4,
62+
"id": "a8ce63ba",
63+
"metadata": {},
64+
"outputs": [
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"3\n",
70+
"4\n",
71+
"5\n"
72+
]
73+
}
74+
],
75+
"source": [
76+
"for i in range(3, 6):\n",
77+
" print(i)"
78+
]
79+
},
80+
{
81+
"cell_type": "code",
82+
"execution_count": 5,
83+
"id": "615f1163",
84+
"metadata": {},
85+
"outputs": [
86+
{
87+
"name": "stdout",
88+
"output_type": "stream",
89+
"text": [
90+
"0\n",
91+
"-2\n",
92+
"-4\n",
93+
"-6\n",
94+
"-8\n",
95+
"-10\n",
96+
"-12\n",
97+
"-14\n",
98+
"-16\n",
99+
"-18\n"
100+
]
101+
}
102+
],
103+
"source": [
104+
"for i in range(0, -20, -2):\n",
105+
" print(i)"
106+
]
107+
},
108+
{
109+
"cell_type": "code",
110+
"execution_count": 6,
111+
"id": "f499a755",
112+
"metadata": {},
113+
"outputs": [],
114+
"source": [
115+
"lista = ['Morango', 'Banana', 'Abacaxi', 'Uva']\n",
116+
"lista_tamanho = len(lista)"
117+
]
118+
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": 7,
122+
"id": "260c7029",
123+
"metadata": {},
124+
"outputs": [
125+
{
126+
"name": "stdout",
127+
"output_type": "stream",
128+
"text": [
129+
"Morango\n",
130+
"Banana\n",
131+
"Abacaxi\n",
132+
"Uva\n"
133+
]
134+
}
135+
],
136+
"source": [
137+
"for i in range(0, lista_tamanho):\n",
138+
" print(lista[i])"
139+
]
140+
},
141+
{
142+
"cell_type": "code",
143+
"execution_count": 8,
144+
"id": "9bc8e6f9",
145+
"metadata": {},
146+
"outputs": [
147+
{
148+
"name": "stdout",
149+
"output_type": "stream",
150+
"text": [
151+
"Morango\n",
152+
"Banana\n",
153+
"Abacaxi\n",
154+
"Uva\n"
155+
]
156+
}
157+
],
158+
"source": [
159+
"for i in lista:\n",
160+
" print(i)"
161+
]
162+
},
163+
{
164+
"cell_type": "code",
165+
"execution_count": 9,
166+
"id": "abeba1a5",
167+
"metadata": {},
168+
"outputs": [
169+
{
170+
"data": {
171+
"text/plain": [
172+
"range"
173+
]
174+
},
175+
"execution_count": 9,
176+
"metadata": {},
177+
"output_type": "execute_result"
178+
}
179+
],
180+
"source": [
181+
"# Tudo em Python é um objeto\n",
182+
"type(range(0,3))"
183+
]
184+
},
185+
{
186+
"cell_type": "code",
187+
"execution_count": null,
188+
"id": "d260c6fb",
189+
"metadata": {},
190+
"outputs": [],
191+
"source": []
192+
}
193+
],
194+
"metadata": {
195+
"kernelspec": {
196+
"display_name": "Python 3 (ipykernel)",
197+
"language": "python",
198+
"name": "python3"
199+
},
200+
"language_info": {
201+
"codemirror_mode": {
202+
"name": "ipython",
203+
"version": 3
204+
},
205+
"file_extension": ".py",
206+
"mimetype": "text/x-python",
207+
"name": "python",
208+
"nbconvert_exporter": "python",
209+
"pygments_lexer": "ipython3",
210+
"version": "3.9.12"
211+
}
212+
},
213+
"nbformat": 4,
214+
"nbformat_minor": 5
215+
}

0 commit comments

Comments
 (0)