-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconditionals.html
More file actions
136 lines (110 loc) · 4.23 KB
/
conditionals.html
File metadata and controls
136 lines (110 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Condicionales - Python 101</title>
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/white.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Condicionales - Python 101</h1>
<p>
<small>Por <a href="https://michelletorres.mx/acerca">Michelle Torres</a> / <a href="http://twitter.com/nmicht">@nmicht</a></small>
</p>
</section>
<section data-markdown>
<textarea data-template>
Una condicional es una estructura de control que nos permite ejecutar un bloque de código solo si se cumple una condicional.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
```python
if x < 0:
print('El valor de x es menor a cero')
```
En este ejemplo, se evalua que el valor de la variable x sea menor a cero, y en caso de que esto sea verdadero, entonces ejecutara el código dentro del bloque.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Sino
En una condicional se busca que se cumpla una condición, pero en caso que esto no ocurra, se puede entonces programar para el caso `sino`
```python
if x < 0:
print('El valor de x es menor a cero')
else:
print('El valor de x NO es menor a cero')
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Elif
Anidar condiciones es la opción de unir condiciones `if` con sus casos `sino`. Ejemplo "Quiero ir a bailar, sino, si el día no es frío, quiero ir a nadar" esto sería un else y un if, pero en python podemos abreviar con `elif`
```python
if x < 0:
print('El valor de x es menor a cero')
elif x == 0:
print('El valor de x es cero')
else:
print('El valor de x es mayor a cero')
```
</textarea>
</section>
<section data-markdown>
<textarea data-template>
En otros lenguajes de programación existe la estructura `switch`, sin embargo en python esta no existe.
</textarea>
</section>
<section>
<a href="./loops.html">Siguiente: Ciclos</a>
</section>
<section>
<h1>GRACIAS</h1>
<h3>Contáctame</h3>
<ul>
<li>hola@michelletorres.mx</li>
<li>@nmicht</li>
<li>https://michelletorres.mx</li>
</ul>
<p>
<small>Por <a href="https://michelletorres.mx/acerca">Michelle Torres</a> / <a href="http://twitter.com/nmicht">@nmicht</a></small>
</p>
</section>
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
controls: true,
slideNumber: false,
dependencies: [
{ src: 'reveal.js/plugin/markdown/marked.js' },
{ src: 'reveal.js/plugin/markdown/markdown.js' },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>