From 059f61ababbd597abefc6c11fd3c4160b21f83f7 Mon Sep 17 00:00:00 2001 From: splitlang <162422117+splitlang@users.noreply.github.com> Date: Sun, 26 May 2024 11:02:56 +0300 Subject: [PATCH] Update looping.py --- lib/looping.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/looping.py b/lib/looping.py index 1b4ce5f0c..06656a905 100644 --- a/lib/looping.py +++ b/lib/looping.py @@ -1,13 +1,28 @@ #!/usr/bin/env python3 def happy_new_year(): - # code goes here! - pass + counter = 10 + while counter > 0: + print(counter); + counter -= 1 + print("Happy New Year!") + + def square_integers(int_list): - # code goes here! - pass + square_list = [] + for num in int_list: + square_list.append(num ** 2) + return square_list def fizzbuzz(): - # code goes here! - pass + for i in range(1, 101): + if i % 3 == 0 and i % 5 == 0: + print("FizzBuzz") + elif i % 3 ==0: + print("Fizz") + elif i % 5 == 0: + print("Buzz") + else: + print(i) +