Skip to content

Tag: function

Creating a class property using a function

I found this fantasy name generator here. I am trying to adapt the code to suit my purpose. I want to create an NPC name automatically, using the function name_gen within the class NPC. With the NPC characteristics being: The code from the name generator I need is the following: Now the only thing I think I s…

Why my function (f(x)=x*2) doesn’t returns anything?

I know that there are way simpler ways to calculate the square of a number and store it in an array, but for the sake of another problem. I need to understand why nothing happens in this code and its structure (is the return(a) necessary ?): The goal is to store the square in sol : sol = [1,4,9,16,25]. But

Python skipping functions when ran in VS Code

I have written the following python code to read in XYZ data as CSV and then grid to a GTiff format. When I run the code I am getting no errors. However, after trying to debug, I added some print statements and noticed that the functions aren’t actually being called. How can I run this script so that it…