I am working on a tax calculator in Python, and am wondering if it is at all possible to direct string-based input to a function. When I run the program, it does nothing past the initial input. My code snippet is as follows:
class TaxCalculator():
type_of_pay = input(
"Do you get paid hourly or salary? (Enter hourly or salary)")
if type_of_pay == "hourly":
def hourly(self):
rate = input("What do you get paid per hour")
hours = input("Roughly how many hours do you work per week?")
overtime = input(
"Do you earn overtime? If so, answer with the rate, otherwise press enter.")
I am not sure if I need to include the self bit in there, as I don't use it (still learning python).