-
Notifications
You must be signed in to change notification settings - Fork 3
/
lesson5.html
executable file
·112 lines (103 loc) · 4.03 KB
/
lesson5.html
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
<!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>Week 5 - Exercises</title>
<link rel="stylesheet" href="reveal/css/reveal.css">
<!-- Theme set to Simple Serif with custom overrides below -->
<link rel="stylesheet" href="reveal/css/theme/simple.css">
<link rel="stylesheet" href="static/css/custom.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal/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/css/print/pdf.css' : 'reveal/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- TITLE SLIDE -->
<section>
<br>
<h2>Python 101</h2>
<h3>Week 5:<br>Exercises</h3>
<p>
<small>Expedia Code Academy</small>
<br>
<img src="static/img/code_academy_logo.png" border="0px">
</p>
</section>
<section>
<h3>Exercises</h3>
<pre><code class="python" data-trim>
random_numbers = [1, 5, 0, -2, 3, -4, -3, 11, 5]
</code></pre>
<li>
(⭐️) 5a. Using a for loop, calculate the sum of <span id="code">random_numbers</span>
</li>
<li>
(⭐️⭐️) 5b. Print odd numbers between 1 and 50. Hint:
<pre><code class="python" data-trim>
# Use % (known as modulo), the remainder operator
10 % 2 # 0, as 10 divided by 2 is 5 with no remainder
11 % 4 # 3, as 11 divided by 4 is 2 with a remainder of 3
</code></pre>
</li>
<li>
(⭐️️⭐️) 5c. Create a new list containing only the negative numbers
<br>
Hint: Use <a href="https://python101ldn.github.io/slides/lesson3.html#/4">append</a>
</li>
</section>
<section>
<h3>Exercises</h3>
<li>
(⭐️️⭐️) 5d. Bob again! Use a while loop to get Bob to continually talk to you until you say 'bye'.
</li>
<br>
<li>
(⭐⭐⭐) 5e. Count the number of vowels in a string provided by the user using <span id="code">input()</span>.
<br>
Example: given input "hello", the program will output 2
</li>
<br>
<li>
(⭐️⭐️⭐️) 5f. FizzBuzz! See <a href="https://github.com/python101ldn/exercises/blob/master/Session_5/5f_fizzbuzz.py">here</a> for a description
</li>
</section>
<section>
<h3>Exercises</h3>
<br>
<li>
(⭐⭐⭐🔥) 5g. Print some Christmas trees! See <a href="https://github.com/python101ldn/exercises/blob/master/Session_5/5h_xmas_trees.py">here</a> for a description
</li>
</section>
</div>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/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({
dependencies: [
{ src: 'reveal/plugin/markdown/marked.js' },
{ src: 'reveal/plugin/markdown/markdown.js' },
{ src: 'reveal/plugin/notes/notes.js', async: true },
{ src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
],
history: true,
progress: false,
center: false, // disable vertical centering of text
transition: 'none'
});
</script>
</body>
</html>