294x Filetype PDF File size 2.95 MB Source: exo7.emath.fr
PYTHON IN HIGH SCHOOL
ARNAUD BODIN
ALGORITHMS AND MATHEMATICS
Exo7
Pythoninhighschool
Let’s go!
Everyone uses a computer, but it’s another thing to drive it! Here you will learn the basics of programming.
The objective of this book is twofold: to deepen mathematics through computer science and to master
programming with the help of mathematics.
Python
Choosing a programming language to start with is tricky. You need a language with easy handling, well
documented,withalargecommunityofusers.Pythonhasallthesequalitiesandmore.Itismodern,powerful
and widely used, including by professional programmers.
Despite all these qualities, starting programming (with Python or another language) is difficult. The best
thing is to already have experience with the code, using Scratch for example. There are still big steps to
climb and this book is here to accompany you.
Objective
Mastering Python will allow you to easily learn other languages. Especially since the language is not the
most important, the most important things are the algorithms. Algorithms are like cooking recipes, you
have to follow the instructions step by step and what counts is the final result and not the language with
which the recipe was written. This book is therefore neither a complete Python manual nor a computer
course, nor is it about using Python as a super-calculator.
The aim is to discover algorithms, to learn step-by-step programming through mathematical/computer
activities. This will allow you to put mathematics into practice with the willingness to limit yourself to the
knowledge acquired during the first years.
Mathematics for computer science
Computer science for mathematics
Since computers only handle numbers, mathematics is essential to communicate with them. Another
example is the graphical on-screen display that requires a good understanding of the coordinates (x, y),
trigonometry....
Computers are a perfect match for mathematics! The computer becomes essential to manipulate very large
numbers or to test conjecture on many cases. In this book you will discover fractals, L-systems, brownian
trees and the beauty of complex mathematical phenomena.
You can retrieve all the activity P②t❤♦♥ codes and all the source files on the Exo7 GitHub page:
GitHub: Python in high school
Contents
I Getting started 1
1 Hello world! 2
2 Turtle (Scratch with Python) 9
II Basics 18
3 If ... then ... 19
4 Functions 25
5 Arithmetic – While loop – I 34
6 Strings – Analysis of a text 41
7 Lists I 51
III Advanced concepts 59
8 Statistics – Data visualization 60
9 Files 69
10 Arithmetic – While loop – II 78
11 Binary I 83
12 Lists II 90
13 Binary II 96
IV Projects 99
14 Probabilities – Parrondo’s paradox 100
15 Find and replace 103
16 Polish calculator – Stacks 108
17 Text viewer – Markdown 120
18 L-systems 127
19 Dynamic images 135
20 Gameoflife 141
21 Ramseygraphsandcombinatorics 147
22 Bitcoin 156
23 Randomblocks 165
V Guides 172
24 Python survival guide 173
25 Mainfunctions 182
26 Notes and references 198
Index
no reviews yet
Please Login to review.