By Timo van Werkhoven
Here we can put all discussed topics to the test. Whenever you get stuck at an exercise, make sure to check out the tips section in this md below.
To edit and run this project, you can undertake the following steps
- Install Python, at least v3.9, make sure Python get added to the system PATH (checkable option during installation wizard).
- Download this project to your machine, press the green
codebutton followed byDownload zip. Unpack the Zip afterwards. - Download an editor/IDE, many good options. If no personal preference, VScode is recommended.
- Open VScode, select open folder, select the unpacked Zip from step 2
- Install the following extensions
Ctrl + Shift + x.autopep8- intellicode
- powershell
- pylance
- python
- Link the downloaded python Interpreter to VScode by doing:
Ctrl + Shift + p -> Python: select interpreterand select the interpreter which is likely at%user%\AppData\Local\Programs\Python\Python311
- Open a terminal and check if py is callable
py --version. (In VScode an integrated terminal is availableCtrl + Shift + `) - Ready to exercise! Go to the exercise file of your choosing, look at the jokingly title and tasks and fill in the blanks between the below and above code. Everytime you want to try out an exercise enter in the terminal:
py app.py
View it as a cabinet with documents. The '=' sign is telling everyone: 'At this location ive named myself I will put this bit of information'.
So for example: drawerB = 5.
When googling a solution for this task, changing the type of a value is often called parsing or casting. For checking if the type-changing code worked, you need to use a try-except block (so not an if).
This is more a show and tell. The missing code is only one line.
When trying to determine what the code should do, keep in mind there can also be spaces after the x-es.
Keywords to search for when googling are class, constructor, attribute, method.
Just removing the line myCar.colour = 'geel' is not an option.
How do we make sure both variables are not related?
The keyword def is vital here. Try and create code resulting in the ifelse block only being present once.
The keyword to google for is function parameter.
