Skip to content

Python Function parameters and arguments

I want to understand functions and arguments better, I’ve read and this is my implementation of what I have read. I have 3 small functions to illustrate my point. User input collection, grading function and main. If I run the main function without its argument (1), it results in an error looking for the…

Python opencv/cvzone – UnboundLocalError

I am trying to make a ar mouse (camera vould detect your hand and than your finger vould be the mouse). But when checking which fingers are up I get an error. When making this program I followed this tutorial: https://www.youtube.com/watch?v=8gPONnGIPgw&t=332s. When doing that I made one thing different w…

How can show the singleton object’s attribution?

We can show instance’s attribution with dir function. Now create a class with metaclass method: Show Cls’s _instances attrubution: Why no string _instances in dir(Cls)? Answer Because it’s stored on the metaclass. To be clear, this has nothing to do with the singleton aspect.

write filename when iterating through dataframes

I am passing to a function several pandas df: df here will be a pandas dataframe. How can I assign the diferent parameters of *args to a string like above ‘/transformed/’+str(df)+’.table’,sep=’t’ ?? I want to have three files written to disk with the following path: Answer …