Hints¶
Note
This site is currently under construction. Please use the temporary content with care.
Before we take on any useful examples on how you can use Python, let’s have a slight introduction to the basics.
You might be confronted with a lot of unknown terms and an unfamiliar terminology. Do not be scared off by this and things you may not understand immediately! Once you have read through the examples and experimented with them yourself, it will start to feel more and more natural to you.
Here are a few general recommendations in loose order without any claim to completeness.
Resist the temptation to copy and paste code when you try it out in your own Python session! By re-typing the examples you will be better able to memorise them and you will get used to the syntax.
But: be lazy! Whenever you feel like what you are typing is repetitive, there is probably a better way to do it. When you realise you need to type the same thing twice, it might be a good idea to refactor it into a loop or a function. On the other hand, if you start to write a program don’t start with writing a function. A function that is only used once does not deserve to be a function.
Reinvent the wheel: Rename variables, retype code in your own style.