Skip to content

Tag: python

Flask handling multiple errors

I have a simple app made in Flask. It uses only POST method. It takes 2 numbers (in json) and adds them up. The application responds with the sum of these numbers (also in json). The code looks like this: I would like to do error handling. The problem is that there are a lot of these errors, e.g. for

Replacing certain parts of a list in Python

I have a list of columns that represents months for different metrics. It was imported from a CSV. There are two issues: (1) The months start with ’22-‘ and (2) some months end with .1 , .2 etc. Here is the list: Tried using .replace but I can’t get it to remove only certain parts of the lis…

I would like to make my program display the order total/invoice

Here is what ive done: I want to display an invoice at the end once the user has completed there order showing there total price. This is some of my code for just the drinks, same type of code used for cheeseburger etc. : Answer You can use something like this: So the base price is 5 for the delivery