Ever heard of the Rule of 72? It’s a classic finance shortcut that tells you how many years it takes for an investment to double at a given interest rate—without reaching for a calculator! Pretty much, if you want to…
The field of geometry offers tools that have withstood the test of time, empowering us to understand and solve a variety of triangular problems. Among these, the Pythagorean Theorem and the Law of Cosines are cornerstone concepts. This article provides…
Object oriented programming (OOP) in general is a huge topic, but I have decided to make a 30 minute video, based on the book Math for Programmers, as I liked the way it was explained there: Generally, in the video,…
Working with Python and Excel is actually quite handy, especially if you are into it. In this article, you can see how to create Excel files, write data and formulas into them and read these. Pretty much simple CRUD methods.…
In the previous article, the post and get API methods were presented. In this one, Put and Delete are coming. 🙂 Well, nothing that fancy, this is how these two methods look like:
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 |
# Update item by id @app.route('/api/items/<int:item_id>', methods=['PUT']) def update_item(item_id): data = request.get_json() updated_data = data.get('item') # Get the nested 'item' data if not updated_data: return jsonify({'error': 'No data provided'}), 400 item = next((item for item in items if item['id'] == item_id), None) if item is None: return jsonify({'error': f'Item #{item_id} not found!'}) # Update fields in the item (dummy db) for key, value in updated_data.items(): if key in item: item[key] = value return jsonify({'message': 'Item updated successfully', 'item':item}), 200 # Delete item by id @app.route('/api/items/<int:item_id>', methods=['DELETE']) def delete_item(item_id): item_to_delete = next((item for item in items if item['id'] == item_id), None) if item_to_delete is None: return jsonify({'error': f'Item {item_id} not found!'}), 404 items.remove(item_to_delete) return jsonify({'message': f'Item: {item_to_delete} has been deleted successfully!'}), 200 |
And, of course tests are a…
Python allows decent built-in logging. As I am going to explain in the video below, the built-in logging is actually rather neat – it allows everyone to log into a file or into the console within minutes – just the…
Creamer’s rule for a solution of linear equations states pretty much the following: Using this interesting picture from the German Wikipedia, I have created the following video, explaining a bit the Rule of Mr. Cramer: The video goes through the…
Same article, but for VBA is here – https://www.vitoshacademy.com/vba-split-worksheet-to-worksheets-save-excel-worksheets-to-csv/ This article does 2 things: Splits one worksheet to multiple worksheets Then goes through the worksheets and saves them as *.CSV files So what is the idea? Having this excel file,…