Python Join Arguments and String Concatenation

Problem: Write a function that joins an arbitrary number of string arguments with a given separator. Example: Given the string arguments “A”, “B”, and “C” and the string separator “-“. Join them to the concatenated string “A-B-C”. Solution: The following code creates a Python function concat() that takes an arbitrary number of arguments, packs them … Read more

Python getattr()

Python’s built-in getattr(object, string) function returns the value of the object‘s attribute with name string. If this doesn’t exist, it returns the value provided as an optional third default argument. If that doesn’t exist either, it raises an AttributeError. An example is getattr(porsche, ‘speed’) which is equivalent to porsche.speed. Usage Learn by example! Here’s an … Read more

Python delattr()

Python’s built-in delattr() function takes an object and an attribute name as arguments and removes the attribute from the object. The call delattr(object, ‘attribute’) is semantically identical to del object.attribute. This article shows you how to use Python’s built-in delattr() function. Usage Learn by example! Here’s an example on how to use the delattr() built-in … Read more

Merry Christmas from Chris & all Finxter Creators! ❤

Thanks for being an active member of our exclusive club of lifelong learners. ?? We’re so grateful for all the time you spend learning and improving your skills. Please be assured—for all the trust, time, and effort you put into Finxter, we’re never going to let you down. The team of Finxter Creators is here … Read more