From c15dd2516abeade972c829db9f3035807116dbea Mon Sep 17 00:00:00 2001 From: borislav nikolov Date: Sun, 10 Dec 2023 22:47:08 +0100 Subject: [PATCH] today --- week-049.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 week-049.md diff --git a/week-049.md b/week-049.md new file mode 100644 index 00000000..1b254152 --- /dev/null +++ b/week-049.md @@ -0,0 +1,29 @@ +## [DAY-367] functions + +make a fizzbuzz function that takes a parameter the final number to fizzbuzz to, also make another function to check if a number is prime, and print the prime numbers in the fizzbuzz function + + +``` +def is_prime(n): + if n== 0 or n == 1: + return False + for x in range(2,n): + if n %x==0: + return False + return True +def fizzz(x): + for i in range(x): + if i%15==0: + print("fizzbuzz") + elif i%5==0: + print("buzz") + elif i%3==0: + print("fizzz") + else: + if is_prime(i): + print("prime " + str(i)) + else: + print(i) +fizzz(100000000000000) + +```