Can someone kindly help with these code please

count = 1
while count <= 3:
	yearly_income = input("Please enter your yearly income: ")

	if yearly_income.isdigit():
        flag = "Y"
# to end the loop
        count = 4
    else:
    	print(f"Declare your yearly income :{yearly_income}")
        print("[INVALID INPUT] Only number is accepted, please re-enter again."
    	count += 1

i get the below error:

image

your indentation problem starts from here
should be something like this

count = 1
while count <= 3:
    yearly_income = input("Please enter your yearly income: ")

    if yearly_income.isdigit():
        flag = "Y"
        count = 4
    else:
        print(f"Declare your yearly income :{yearly_income}")
        print("[INVALID INPUT] Only number is accepted, please re-enter again.")
        count += 1

are you coding from command line? I tried your code using a python environment in VS code on my Mac and it worked (sorta) I’m not sure what you are trying to build here. Is it an input type check with 3 chances then the program closes?

thanks all for helping out!

With str.isdigit and user input one must keep in mind that not all digits passing that can be converted into int for using in calculations:

>>> value = '1²'
>>> value.isdigit()
True
>>> int(value)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1²'