Close
Close

keeps errorin can you check my code?

   wildAngel

print("Enter your Salary")

salary = input()

print("Enter your Years of service:")

YOS = input()

if YOS < 5:

print("no bonus")

else:

bonus = (salary * 5)//100

print("Your bonus is:" + bonus) 

and heres the error

Traceback (most recent call last): File "C:\Users\Mandana\Desktop\5%bonus\main.py", line 5, in if y >= 5: TypeError: '>=' not supported between instances of 'str' and 'int' 

  • Hello! in line 4, you should make it int(input())
    - PerihanGummadova
  • plus, that would be more efficient to remove the print statements and put them into the input statements: like the first 2 lines can be shrinked into: salary = input("Enter your Salary")
    - PerihanGummadova

Answers

  •    johnsmith885

    Hi ! Line 4 should be changed to int(input()). 
    smash karts



Ask Yours
Post Yours
Write your answer