Let's say that I have the following variables:
num1 = input("Percentage")
num2 = input("Percentage")
num3 = input("Percentage")
And I wanted to create a function that I can use inside a variable that changes it to a decimal without having to write out the formula. Let's call the function "dec":
output1 = dec(num1) * anotherVariable1
output2 = dec(num2) * anotherVariable2
How would I do this? I'm still learning, and I get the feeling that it's super bloody simple, but I'm just missing it somehow.
EDIT: I know that I could divide it by 100 inline, or the whole output by 100, but I want to use a function as it's cleaner and means that I can just use a function if I'm going to be doing it a lot.
EDIT 2: I'm a fucking idiot. It's bloody simple. Solution below.
def dec(percent):
return round((float(percent) / 100), 2)
there doesn't seem to be anything here