making variable if it is none python

var = None
if var == None:
    var = ""

Here is what the above code is Doing:
1. It’s creating a variable called var and setting it to None.
2. It’s checking if var is None.
3. If var is None, it’s setting var to an empty string.
4. It’s printing var.

If you run this code, you’ll see that it prints an empty string.

This is because when var is None, the if statement sets it to an empty string.

You can use this same technique to set a default value for a function argument.