121 lines
4.0 KiB
Markdown
121 lines
4.0 KiB
Markdown
|
# What we'll learn
|
||
|
|
||
|
You'll learn **three** things at the same time so don't get discouraged if it feels a bit much at the start.
|
||
|
Everybody's issues will be in these three different domains and at the beginning it can be difficult to differentiate between them.
|
||
|
Keep this in mind, everybody has to go through this stage and the *click* comes at different times for different people but everybody clicks at some point!
|
||
|
The three new things you'll learn:
|
||
|
|
||
|
1. the **concepts** of programming, most notably Object Orientated Programming (OOP)
|
||
|
2. the **syntax** of one particular language, in our case Python3
|
||
|
3. the **tools** needed to start programming in our language of choice
|
||
|
|
||
|
Within each of these topics there are *subtopics* but there are not bottomless!
|
||
|
Below is a small overview of how I would subdivide them.
|
||
|
|
||
|
## Concepts
|
||
|
|
||
|
The subtopics behind the concept of programming can be sliced (in no particular order) as follows:
|
||
|
|
||
|
* objects
|
||
|
* variables
|
||
|
* conditional logic
|
||
|
* functions
|
||
|
* loops
|
||
|
|
||
|
The concept behind these topics are the same in most languages, it's just *how* you write them that is different.
|
||
|
This *how* is part of the **syntax** of the language.
|
||
|
|
||
|
## Syntax
|
||
|
|
||
|
> In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be correctly structured statements or expressions in that language.
|
||
|
> This applies both to programming languages, where the document represents source code, and to markup languages, where the document represents data.
|
||
|
> The syntax of a language defines its surface form.[1] Text-based computer languages are based on sequences of characters,
|
||
|
|
||
|
The quote above is taken shamelessly from [wikipedia](https://en.wikipedia.org/wiki/Syntax_(programming_languages)).
|
||
|
|
||
|
## Tools
|
||
|
|
||
|
### Writing code
|
||
|
|
||
|
Scripts are text files, plain and simple.
|
||
|
So in order to **write** a Python3 script all we need is a text editor.
|
||
|
Nano, vim, notepad++ all do a good job of editing plain text files but some make it *easier* than others.
|
||
|
You've noticed that vim colors the code of a shell script no?
|
||
|
One of the many features of an [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) is *syntax highlighting*.
|
||
|
It colors things such as [keywords](https://realpython.com/python-keywords/) which makes our life so much nicer when writing code.
|
||
|
We'll come back to these features in a bit.
|
||
|
|
||
|
### Running code
|
||
|
|
||
|
In order to **run** Python3 code you need the Python3 interpreter.
|
||
|
This is because when you **execute** your script, the interpreter will **read and execute** each line of the text file **line by line**.
|
||
|
|
||
|
Most people who want to write and run Python3 code, or any language for that matter, will install an Integrated Development Environment to do so.
|
||
|
There are no *rules* as to what has to be included for a program to qualify as an IDE but in my opinion they should include:
|
||
|
|
||
|
* syntax highlighting
|
||
|
* autocomplete
|
||
|
* *goto* commands such as goto definition, goto declaration, goto references
|
||
|
* automatic *pair* opening and closing
|
||
|
* builtin help navigation
|
||
|
|
||
|
There is a plethora of IDE's available and you can't really make a *wrong* choice here, but to make the overall learning curve a bit less steep we'll start out with a user friendly IDE, [pycharm](https://www.jetbrains.com/help/pycharm/installation-guide.html).
|
||
|
|
||
|
# The python3 shell
|
||
|
|
||
|
TODO animated overview of the shell and the world of OOP
|
||
|
|
||
|
# Installing pycharm
|
||
|
|
||
|
TODO
|
||
|
|
||
|
# Your first project
|
||
|
|
||
|
TODO helloworld
|
||
|
|
||
|
## Simple printing
|
||
|
|
||
|
## String formatting
|
||
|
|
||
|
## String replacement
|
||
|
|
||
|
# Taking input
|
||
|
|
||
|
TODO say hello program
|
||
|
|
||
|
## Functions can return something
|
||
|
|
||
|
# Taking input and evaluation
|
||
|
|
||
|
TODO say hello plus ask for age
|
||
|
|
||
|
## Conditional logic
|
||
|
|
||
|
## Class string methods
|
||
|
|
||
|
# Coding challenge - Celsius to Fahrenheit converter
|
||
|
|
||
|
# Creating your own functions
|
||
|
|
||
|
TODO pretty_print
|
||
|
|
||
|
## Functions that *do* something
|
||
|
|
||
|
## Functions that *return* something
|
||
|
|
||
|
# Writing your first library
|
||
|
|
||
|
TODO import pretty print
|
||
|
|
||
|
## What are libraries?
|
||
|
|
||
|
## How do we write libraries?
|
||
|
|
||
|
## What is `__name__ == "__main__"`?
|
||
|
|
||
|
# Using the standard library
|
||
|
|
||
|
TODO import random exercise
|
||
|
|
||
|
|