2022-10-11 19:27:51 +00:00
|
|
|
def main():
|
|
|
|
num = int(input('De onde vai começar o contador? '))
|
2022-10-18 17:18:56 +00:00
|
|
|
for n in countdown(num):
|
|
|
|
print(n)
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2022-10-19 08:47:23 +00:00
|
|
|
|
|
|
|
# Creates a range() function with the format range(n:0:-1)
|
|
|
|
# The statement yield returns a value every repetition
|
2022-10-11 19:27:51 +00:00
|
|
|
def countdown(n):
|
2022-10-18 17:18:56 +00:00
|
|
|
while n > 0:
|
|
|
|
yield n
|
|
|
|
n -= 1
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
if __name__ == "__main__":
|
2023-05-16 20:14:36 +00:00
|
|
|
main()
|