Notice the spaces at the beginning of the line. These tell Python that this line of code is part of the definition of the countdown function, and not just some code below it. You can use any number of spaces, but you need to use the same amount before any line that you want to indent once. You will need to indent the next code lines twice, because they are both part of the function definition and part of the while-loop. This is done by using twice as many spaces.

Note that this line is only indented once. This is because it is no longer part of the while-loop. This code is only run after the while-loop finishes.

Print the question to the user. They need to know what they are supposed to enter. print(“How many seconds to count down? Enter an integer:”) Get the answer. Store the answer in a variable so that you can do something with it later. seconds = input() While the user’s answer is not an integer, ask the user for another integer. You can do this with a while-loop. If the first answer is already an integer, the program will not enter the loop and just proceed with the next code. while not seconds. isdigit(): print(“That wasn’t an integer! Enter an integer:”) seconds = input() Now you can be sure that the user entered an integer. However, it is still stored inside a string (input() always returns a string, because it can’t know whether the user will enter text or numbers). You need to convert it to an integer: seconds = int(seconds) If you would have tried to convert a string whose content isn’t an integer into an integer, you would get an error. This is the reason while the program checked whether the answer was actually an integer first.

The empty lines are only there to make the code easier to read. They are not required, and Python actually ignores them. You can write t = t - 1 instead of t -= 1 if you prefer.