Hi guys, can anyone help me with my code. I`m trying to create an income calculator module but it just won`t work

yearlyPay = 0
startSession = str(input(“Welcome to the ATO, would you like to start your session?”))
response = startSession.upper()
if response == “NO”:
print(“Have a nice day, bye!”)
elif response == “YES”:
selectionTime = (input(“Please pick Daily (D), Weekly (W), Fortnightly (F), Monthly (M) or Yearly pay (Y)”))
if selectionTime := “Y”:
yearlyPay = int(input(“What is your yearly pay?”))
elif selectionTime := “W”:
weeklyPay = int(input(“What is your weekly pay?”))
yearlyPay == weeklyPay * 52
elif selectionTime := “F”:
fortnightlyPay = int(input(“What is your fortnightly pay?”))
yearlyPay == fortnightlyPay * 26
elif selectionTime := “M”:
monthlyPay = int(input(“What is your monthly pay?”))
yearlyPay == monthlyPay * 12
elif selectionTime := “D”:
dailyPay = int(input(“What is your daily pay?”))
yearlyPay == dailyPay * 365


In some locations, you are using the equality check operator (==) where it seems more appropriate to be using the assignment operator (=). As an example:
yearlyPay == weeklyPay * 52
This line will see if the thing on the left is the same as the thing on the right and then ignore whatever the answer is. I’m assuming you meant to change the thing on the left instead.

The first line in the program sets yearlyPay to zero. If you didn’t have that line, you would have seen a nice error message from the other locations that yearlyPay was unassigned. The first line seems to be unused. I would remove it.

You`re right, I do want to set yearlyPay as weeklyPay * 52, not check if yearlyPay equals weeklyPay.

Removing the first line seems to have no effect but add red lines on PyCharm.

That’s a good thing. You want it to yell at you when there is a problem. The first line made it think that those other lines might be correct.

The red lines start if I remove the first line. Also the code still doesn`t work even if I keep it. If you have Pycharm can you copy and paste it to see what the problem might be?

What happens when you try to run it? Do you get any errors? What is the output? Go ahead and show your changes.

Howdy John,

it would be far easier to read your code, if you would use the “</>” (“preformatted text”) button at the top of the editor (select code and then press said button).

Cheers, Dominik