uaveiro-leci/1ano/fp/aula03/ex12.py

12 lines
221 B
Python
Raw Normal View History

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
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__":
main()