Skip to content

draw a box that takes a input as the box size

I’m trying to learn Python. One of the tasks is to make a box with a dynamic box. Here’s an example of how it’s supposed to work: Here’s my code: My box is all wrong: Answer You just need to centre align your string to the correct width, replace the middle print statement with: print(s…

Draw a simple box around a string

I’m trying to learn python, and one of the “tasks” asks me to draw a box around a string. For some reason, I can’t come to a solution. This is supposed to be super basic so we can’t use functions and loops etc. Here’s the task: (I’m stuck on question 2) Load a string …

How to calculate total column using python

I am creating an inventory system in Python. Treeview table total column need to calculate and display sum using python. I need to calculate final total of total column. I tried but I could the result what I tried so far I attached below. I got an error sum1 += tot TypeError: unsupported operand type(s) for +…

How to save UploadFile in FastAPI

I accept the file via POST. When I save it locally, I can read the content using file.read (), but the name via file.name incorrect(16) is displayed. When I try to find it by this name, I get an error. What might be the problem? My code: Answer Background UploadFile is just a wrapper around SpooledTemporaryFi…