Dec-11-2020, 02:47 PM
I think you are trying to write:
if type(n) is not int: n = int(n)But since it is valid to pass an integer to int() why not just do this?
def countdown(n): n = int(n) while n > 0: print(n) n = n - 1 print('Blastoff!')Or this
def countdown(n): for i in range(int(n), 0, -1): print(i) print('Blastoff!')