-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathslides-en.html
More file actions
1473 lines (1042 loc) · 42.2 KB
/
slides-en.html
File metadata and controls
1473 lines (1042 loc) · 42.2 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Ladies Learning Code</title>
<link rel="stylesheet" href="framework/css/slideshow.css" data-noprefix>
<link rel="stylesheet" href="framework/css/fonts.css" data-noprefix>
<link rel="stylesheet" href="framework/css/highlightjs/github.css" data-noprefix>
<link rel="stylesheet" href="framework/css/styles.css" data-noprefix>
<link rel="shortcut icon" href="framework/img/favicon.ico">
<!-- Takes care of CSS3 prefixes -->
<script src="framework/scripts/prefixfree.min.js"></script>
<!-- opens all links in a new window -->
<base target="_blank">
</head>
<!-- Timer/progress bar: Define the presentation duration using "data-duration" in minutes. -->
<body class="en" data-duration="360">
<main>
<section class="slide welcome highlight">
<h1><img class="logo-stacked" src="framework/img/llc-logo-stacked-white.png" alt="Ladies Learning Code logo">Welcome!</h1>
<div class="instructions">
<!-- ADD WIFI INFO HERE -->
<h2>Get <br>Connected</h2>
<p><strong>Wifi:</strong> Network</p>
<p><strong>Password:</strong> Password</p>
<hr>
<h2>Download<br> & Install</h2>
<ol class="downloads">
<li>Learner files (zip file): <a href="https://github.com/ladieslearningcode/llc-python/archive/master.zip">http://bit.ly/llc-python3</a></p>
<ul>
<li>unzip the learner file (<em>extract all</em> if you’re on a PC)</li>
<li>open <em>slides.html</em> in the browser to view the slides</li>
</ul>
</li>
<li>Installation Instructions by Platform:</li>
<ul>
<li><a href="installation/windows.html">Windows</a></li>
<li><a href="installation/mac.html">Mac</a></li><br><br>
</ul>
</ol>
</div>
<footer>
<a class="left" rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License"
src="framework/img/cc-by-nc.png" /></a>
<p class="left">Content created by Darcie Milliken for <a
prefix="cc: http://creativecommons.org/ns#" href="http://canadalearningcode.ca" property="cc:attributionName"
rel="cc:attributionURL">Canada Learning Code</a></p>
<p class="right">Use the left <span class="arrow">←</span> and right <span class="arrow">→</span>
arrow keys to navigate</p>
</footer>
</section>
<section class="slide intro">
<img class="logo" src="framework/img/llc-logo-white.png" alt="Ladies Learning Code logo">
<h1 class="heading-bg">
<span>Data Insights with Python</span>
</h1>
<!-- FILL IN INSTRUCTOR DETAILS -->
<!--<img class="instructor" src="https://placehold.it/225x225" alt="Instructor Name">
<h2><span class="cursive">with</span> Instructor name</h2>
<ul>
<li><a href="mailto:">hello@email.com</a></li>
<li><a href="http://website.com">website.com</a></li>
<li><a href="http://twitter.com/">@twitter</a></li>
</ul>
<div class="sponsor">
<p>In partnership with<br><img src="framework/img/telus-logo-white.svg" alt="Telus"><br><img src="framework/img/logo-accenture.svg"
alt="Accenture"></p>-->
</div>
<footer>
<a class="left" rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License"
src="framework/img/cc-by-nc.png" /></a>
<p class="left">Content created by Darcie Milliken for <a
prefix="cc: http://creativecommons.org/ns#" href="http://canadalearningcode.ca" property="cc:attributionName"
rel="cc:attributionURL">Canada Learning Code</a></p>
<p class="right">Use the left <span class="arrow">←</span> and right <span class="arrow">→</span>
arrow keys to navigate</p>
</footer>
</section>
<section class="slide project" data-markdown>
<script type="text/template">
# Today’s project
Python can be used for many useful scientific or business applications working with data. But today we'll be doing something fun.
The [Canadian UFO Survey](http://survey.canadianuforeport.com/) is an organisation which has been collecting data about UFO sightings
across Canada since 1989.
They've generously agreed to let us use their data for this workshop (thanks!)

</script>
</section>
<section class="slide agenda" data-markdown>
<script type="text/template">
## Agenda
###Morning
* Types
* Variables
* Conditionals & Logic
* Lists
* Loops
###Afternoon
* Working with files
* Libraries
* Dictionaries
* Reading data from a csv file
* Final Project
</script>
</section>
<section class="slide" data-markdown data-toc>
<script type="text/template">
#Coders' code
1. Be friendly and welcoming
1. Be respectful of others by choosing words and actions with care
1. Be mindful of how much space you take up in conversations
1. Ask questions
1. Try your best (and have fun!)
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## What is programming? What is code?
* A program starts out as a text file filled with *commands* we want the computer to execute
* Writing these special files is what we mean when we say "writing code"
* Programming languages like python give us tools to write those commands more easily
* In python these have the file extension `.py`
* Another special program takes the file and translates the python commands into another form the computer can use

</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Programming languages
Programming languages give us tools to write commands for our computers to run
For example:
* Do math
* Open a file on your computer
* Search for data in a file
* Download data from a website
* Send emails
* Zip or unzip files
* Work with a database
* and so on!
More: https://docs.python.org/3.7/library/index.html
</script>
</section>
<section class="slide who-uses" data-markdown>
<script type="text/template">
## Who uses Python?
* Data Analysis
* Scientific Computing
* Scripting
* Testing
* Web Applications (Django, Flask)
* and some of your favorite websites!
<!-- * Youtube, Reddit, Pinterest, Instagram, Dropbox, The Onion -->





### Why Python Is Awesome
* Free!
* Open source
* Write once, run anywhere
* Great community
* The syntax looks similar to English
* Meaningful errors, easy to debug
* 4th most popular programming language [(SO Survey 2019)](https://insights.stackoverflow.com/survey/2019)
</script>
</section>
<section class="slide centered" data-markdown>
<script type="text/template">
 <!-- .element: style="width: 60%" -->
</script>
</section>
<section class="slide title" data-markdown>
<script type="text/template">
# Let’s get started!
</script>
</section>
<section class="slide centered" data-markdown>
<script type="text/template">
## PyCharm IDE <br>(Integrated Development Environments)
Use IDEs to write code faster with fewer mistakes.
<br><br>
 <!-- .element: style="width: 60%" -->
</script>
</section>
<section class="slide side-by-side" data-markdown>
<script type="text/template">
## Setting up your project files
Open PyCharm and select **Open**.
Navigate to the **llc-intro-to-python-master** folder & select **Choose**.

The project files contained within the folder will now appear in your Project Tool Window. Select the arrows to open the folders within. Today, you will be working from the **exercises** folder (**exercises > fr** for French).
The **reference** folder contains the answer keys.
The other folders & files are needed to make this slide presentation work, so avoid making edits to them!

</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Running Python in PyCharm
The console is an interactive tool used to test and debug code and is included in PyCharm! Let’s open the console:

The console will pop up at the bottom of the application. Type code (instructions) after the green `>>>` symbol. This symbol is used to represent a space to enter your input but you don’t have to actually type it.

**Pro tip!** You can also open and close the console by selecting the icon in the lower left of PyCharm.
</script>
</section>
<!-- -------------------- -->
<!-- First Steps -->
<!-- -------------------- -->
<section class="slide" data-markdown>
<script type="text/template">
## Python can do math
In the console, after the `>>>`, try out these examples.
The command you input after the `>>>` gets *evaluated* and a value is returned back to you.
```
>>> 2 + 2
4
```
```
>>> 2 * 15
30
```
```
>>> 1 / 2
0.5
```
```
>>> 2 ** 3
8
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Data Types
The previous example used the *integer* number **type** but there are many more.
* Integer (`int`, whole numbers)
* Float (`float`, numbers containing decimals)
* String (`str`, words, sentences, literal text)
* Boolean (`True`, `False`)
* [and many more!](http://www.diveintopython3.net/native-datatypes.html)
To display the type, use `type()` and a data value inside the parentheses.
```
>>> type("hello")
<class 'str'>
>>> type(42)
<class 'int'>
>>> type(3.14159)
<class 'float'>
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Printing
The `print()` **function** (more on this later) outputs values to the screen.
Note the syntax in the examples. Quotes should be included when using a *string* data type.
```
>>> print("Hello World!")
Hello World!
```
```
>>> print(2 + 2)
4
```
```
>>> print("2 + 2")
2 + 2
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Concatenation
**Concatenation** is used to "add" strings together by joining multiple strings into one.
```python
>>> print("Hello " + "World!")
Hello World!
```
More than two:
```python
>>> print("Hello " + "Ladies " + "Learning " + "Code!")
Hello Ladies Learning Code!
```
</script>
</section>
<!-- -------------------- -->
<!--Variables-->
<!-- -------------------- -->
<section class="slide" data-markdown>
<script type="text/template">
## Variables
* Used to store a value to use whenever you need it
* Variables store data in the computer’s memory and a **variable name** is used to fetch their value

</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Variables (Continued)
Use the equal (`=`) symbol to **assign** a value to a variable.
```python
>>> x = 5
>>> print(x)
5
```
Python can do math with variables:
```python
>>> x = 5
>>> y = 4
>>> x * y
20
```
You can store almost anything in a variable, including a string:
```python
>>> animal = "python"
>>> print("My favourite animal is a " + animal)
My favourite animal is a python
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Reassigning Variables
Variables can be changed after the initial declaration by "reassigning" them.
#### strings
```python
>>> animal = "hedgehog"
>>> print("My favourite animal is a " + animal)
My favourite animal is a hedgehog
```
#### math
```python
>>> y = 10
>>> x * y
```
What do you think the value of `x * y` will be? <span class="delayed">`50`</span>
Why?<!-- .element: class="delayed" -->
You changed <!-- .element: class="delayed" -->`y`, but the old value of `x` is still in memory.
Python will remember variable names until you close PyCharm or [clear them manually](https://docs.python.org/3/tutorial/datastructures.html#the-del-statement).
</script>
</section>
<section class="slide list-font-default" data-markdown>
<script type="text/template">
## What's in a name?
Here are some tips & best practices for creating variable names:
* variable names can only use letters, numbers and the underscore (`_`)
* no spaces!
* separate words with the underscore `_` symbol
* `ladies_learning_code`
* they cannot begin with a number
* `1day` gives you an error, `day1` will work.
* variable names should describe the data being stored in them
* `animal = "python"` is better than `a = "python"`
* `animal = "python"` is better than `thing = "python"`
</script>
</section>
<!-- -------------------- -->
<!-- Conditionals & Booleans -->
<!-- -------------------- -->
<section class="slide" data-markdown>
<script type="text/template">
## Conditionals & Logic
When you get ready in the morning you might check the weather to decide what to wear.
 <!-- .element: style="width: 25%" -->
* Is it cold outside? Wear long johns
* Is it raining? Bring an umbrella
When you do this you are evaluating a **condition** (the weather) for true/false value and then making a decision.
Python can do this too.
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Boolean values
Programming languages have **boolean** values called `True` and `False`
They are the result of testing a condition.
### Example
Is it snowing outside? That is either `True` or `False`.
Try this in the console. Create a variable called `weather`
```python
>>> weather = "snowing"
```
Now test it against other weather values.
The double equals symbol (`==`) will check if the value on the right matches the value stored in the variable.
```
>>> weather == "cold"
False
>>> weather == "snowing"
True
>>> weather == "Snowing"
False
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Comparison operators
We used ` == ` to compare strings. How do we compare numbers?
### Comparison Operators
`x == y` : are x and y equal
`x > y` : is x greater than y
`x < y` : is x less than y
`x >= y` : is x greater than or equal to y
`x <= y` : is x less than or equal to y
Try this in the console
```python
>>> x = 4
>>> y = 10
>>> x < y
True
>>> x > y
False
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Conditionals & Logic (Continued)
`if` statements are used to execute different sets of instructions based on the result of a conditional test.
Each `if` statement contains a test. The indented block is the code that will run if the test is `True`
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
```
You can check more than one per `if` block by adding an `elif`.
The `else` block will run if none of the others are true.
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
elif weather == "raining":
print("Bring an umbrella")
else:
print("Who knows?")
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Indentation
In python, indentation is important.
This will not work:
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
```
Python will give you an error:
```python
File "C:/Users/Darcie/Documents/GitHub/llc-intro-to-python/exercises/weather_advice.py", line 3
print("Wear snowpants")
^
IndentationError: expected an indented block
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Create a python file
Using the console is great for playing around.
For more complex programs we will be writing code in a `.py` file. Let’s create a Python file!
1. Right-click (or two-finger tap) on the **exercises** folder to create a new file. Then select **New > Python File**

1. Enter the name `weather_advice.py` in the popup box.

</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Run a python file
Code in a **.py** file is just text until you **run** it through the Python program.
1. To run the code, click the green arrow symbol.

You can also find it in the menu under **View > Tool Windows > Run**
1. The code will run in your console window.

<br>
You can run your program as many times as you like by repeating the steps above.
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Exercise : Simple weather advice (10 mins)
In your file `weather_advice.py`:
* Copy this snippet into the file and change the value for the weather.
* Run it a few times with different values
* Add more `elif` blocks with other weather conditions
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
elif weather == "raining":
print("Bring an umbrella")
else:
print("Who knows?")
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Indenting multiple items
To run more than one instruction per item, they must be indented the same amount.
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
print("Wear a touque")
elif weather == "raining":
print("Bring an umbrella")
else:
print("Who knows?")
```
If the indentation is wrong you'll see an error:
```python
weather = "snowing"
if weather == "snowing":
print("Wear snowpants")
print("Wear a touque")
elif weather == "raining":
print("Bring an umbrella")
else:
print("Who knows?")
```
```python
File "C:/Users/Darcie/Documents/GitHub/llc-intro-to-python/exercises/weather_advice.py", line 5
elif weather == "raining":
^
SyntaxError: invalid syntax
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## And / Or
Sometimes, you can’t neatly capture your conditions with one expression. You may need to combine multiple tests to determine what to do next.
`and`: both things must be true
`or`: either one, or both things must be true
### Example
Suppose a piece of advice applies to multiple situations. This indented block will run in either case.
```python
weather = "snowing"
if weather == "snowing" or weather == 'sleet':
print("Wear boots")
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## EXERCISE : Temperature (15 mins)
* Add a variable called `temperature` to your program
* Add a temperature condition to each elif block, such as:
* snowing and temperature is less than -40
* snowing and temperature is between -20 and -10
* come up with your own
* Run it a few times with different values
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Pro Tip! Use Comments
Programmers use **comments** to leave notes for themselves (and other people reading their code in the future)
* Good comments add information that isn’t immediately obvious
* When python is reading your file, it ignores all the comments
```
# Python will ignore anything after the # symbol
```
### Mini Exercise
Add some comments to your python program and run it again
</script>
</section>
<!-- todo make a visual for this slide -->
<section class="slide" data-markdown>
<script type="text/template">
## Storing Data
Variables allowed us to store one simple piece of data so far.
What about more complex data?
`Data structures` is the fancy term we use to refer to storing that data based on what the data looks like.
* Have a bunch of individual things? → `list` or `array`.
* Example: to-do list
* Have pairs of values that relate to eachother? → `dictionary`.
* Example: A class of students' names and scores on a test
* Have hierarchical data? → `tree`.
* Example: family tree
* Have stuff that needs to be processed in order? → `queue`.
* Example: Coffee orders
* and more!
Further reading and examples: https://www.geeksforgeeks.org/data-structures/
</script>
</section>
<!-- -------------------- -->
<!-- Intro to lists -->
<!-- -------------------- -->
<section class="slide" data-markdown>
<script type="text/template">
## Lists
When we have collections of similar individual things, we might store them in a **list**.
To create a list, type a name for the list, then `=`, then put the items in square brackets.
```python
the_name_of_the_list = ['items', 'separated', 'by','commas']
```
#### Examples:
```python
weather_conditions = ['rainy', 'snowing', 'cloudy','sunny','foggy']
provinces = ['BC', 'AB', 'SK','MB','ON','QC','NL,','NB','NS','PE','YT','NT','NU']
to_do_list = ['Water plants','Clean bathroom','Buy shoes','Become Prime Minister', 'Solve climate change']
prime_numbers = [2,3,5,7,11,13]
```
Just like with variables we want to give our lists good, descriptive names.
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Using Lists
Items in a list can be accessed one at a time.
They are **indexed** (counted) starting at 0.
```python
weather_conditions = ['rainy', 'snowing', 'cloudy','sunny','foggy']
```
Try these in the python console:
```python
>>> weather_conditions[0]
>>> weather_conditions[3]
>>> weather_conditions[10]
```
```python
Traceback (most recent call last):
File "<input>", line 1, in <module>
IndexError: list index out of range
```
Python cannot find `weather_conditions[10]` because it does not exist.
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Functions
* Functions are bundles of code that can be re-used
* The bundle of code is given a name, that is the **function name**
* Use the function by calling it by name with parentheses
* Inputs to the function go in the parentheses
* Functions can
* do work and return nothing (like `print()`)
* take **inputs** and can **return** values (like math functions)

### Mini Exercise
What are some examples of functions in other software (such as [excel](https://support.office.com/en-us/article/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188)) that you might be familiar with?
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Functions for lists
Functions can do more than math.
Suppose we have a list of types of weather.
```python
weather_conditions = ['rainy', 'snowing', 'cloudy','sunny','foggy']
```
What kinds of things could we want to do with this data?
* Add or remove items
* Sort alphabetically
* Find duplicate items
* Count how many items we have
Python provides a number of helpful functions that make these tasks easy.
More: https://docs.python.org/3/tutorial/datastructures.html#more-on-lists
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## Add Items to a List
To add a new item to a list, use the function `append()`
```python
>>> weather_conditions.append('windy')
```
```python
>>> print(weather_conditions)
```
To remove an item from a list, use the function `remove()`
```python
>>> weather_conditions.remove('sunny')
```
```python
>>> print(weather_conditions)
```
To count the number of items you have, use the function `len()`
```python
>>> len(weather_conditions)
```
These are going to come in handy when we have lists with thousands of items.
</script>
</section>
<!-- -------------------- -->
<!-- Loops -->
<!-- -------------------- -->
<section class="slide" data-markdown>
<script type="text/template">
## Loops
One of the most powerful tools we have as programmers is having a computer repeat the same instruction for us many times.
 <!-- .element: width="30%" -->
Python can look at each item in a list in order, and do something with it. We call this **looping** through the list.
### Example
```python
weather_conditions = ['rainy', 'snowing', 'cloudy','sunny','foggy']
for type_of_weather in weather_conditions:
print(type_of_weather)
```
</script>
</section>
<section class="slide" data-markdown>
<script type="text/template">
## EXERCISE : Logic & Lists (20 min)
Let's combine this with what we learned about conditionals.