-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpython.html
158 lines (148 loc) · 6.63 KB
/
python.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
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
<!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>reveal.js</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/epcc.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="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 ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section id="intro">
<h2>First Python Programs</h2>
<table>
<tr>
<td> <img data-src="images/epsrc.png" style="background:none; border:none; box-shadow:none;" height="80" alt="EPSRC Logo"></td>
<td> <img data-src="images/nerc-logo-115.png" alt="NERC Logo"></td>
<td> <img data-src="images/archer_logo_360.png" height="80" alt="ARCHER Logo"></td>
</tr>
</table>
</section>
<section>
<h2>Aims</h2>
<ul>
<li>Start up Python</li>
<li>Do basic maths</li>
<li>Create a Graph</li>
</ul>
</section>
<section>
<h3>Reuse</h3>
<img data-src="images/creativecommons.png" alt="Creative Commons License Image">
<p style="font-size:14px">This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.</p>
<a href="http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_US">http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_US</a>
<p style="font-size:14px">
This means you are free to copy and redistribute the material and adapt and build on the material under the following terms: You must give appropriate credit, provide a link to the license and indicate if changes were made. If you adapt or build on the material you must distribute your work under the same license as the original.
</p>
<p style="font-size:14px">
Note that this presentation contains images owned by others. Please seek their permission before reusing these images.
</p>
</section>
</section>
<section>Python
<section><h2>Not just a snake</h2>
<p>Python is a programming language which is used in many different applications.</p>
<p>It is used in science, data analysis, games and for automating tasks.</p>
<p>Users of ARCHER often use it to automate tasks, prepare data or to visualise results.</p>
</section>
<section><h2>A Command Prompt</h2>
<p>Most applications we use have Graphcial User Interfaces.</p>
<p>We are going to start with the command line Python.</p>
<p>We need to start a command prompt.</p>
<img data-src="images/windwoscmd.png" alt="Windows Command Line">
</section>
<section><h2>Commands</h2>
<p>From the Start Menu:</p>
<ul>
<li>Go to Utilities and choose Command Prompt</li>
<li>Choose Run and type cmd</li>
<li>Go to Anaconda and choose Anaconda Prompt</li>
</ul>
<p>This should start the command line.</p>
</section>
<section><h2>Commands</h2>
<p>Some basics</p>
<ul>
<li>Type "cd" - gives current location</li>
<li>Type "mkdir python" - creates a directory</li>
<li>Type "notepad firstfile.txt" - opens up an editor</li>
<li>Type "dir" - lists your files</li>
<li>Type "del firstfile.txt" - deletes your file</li>
</ul>
</section>
<section><h2>Starting Python</h2>
<p>Type "python"</p>
<pre>
Python 2.7.12 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>>
</pre>
<p>This is the Python interpreter.</p>
</section>
<section>
<p>Type 2+3</p>
<p>Type hello</p>
<p>Type print 'hello'</p>
</section>
<section>
<p>Type a = 5 </p>
<p>Type print a</p>
<p>Type a+5 </p>
</section>
<section>
<p>Type b = [3,4,5]</p>
<p>Type sum(b)</p>
<p>Type len(b)</p>
<p>Type sum(b)/len(b)</p>
</section>
<section>
<p>Type import numpy as np</p>
<p>Type np.mean(b)</p>
</section>
<section>
<p>Type personname = raw_input("Enter your name: ")</p>
<p>Type print 'Hello, %s' % personname</p>
</section>
</section>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
math: {
// mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
config: 'TeX-AMS_HTML-full'
},
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js' },
{ src: 'plugin/math/math.js', async: true }
]
});
</script>
</body>
</html>