Add calculator and weather API scripts in JavaScript and Python

This commit is contained in:
vista-man committed 2025-01-27 18:04:20 +01:00
1 parent aeb58e9cb0
commit f829630017
8 files changed
+251

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
def is_prime(num):
if num <= 1:
return False
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
return False
return True
def generate_primes(N):
primes = []
for num in range(2, N + 1):
if is_prime(num):
primes.append(num)
return primes
# Vraag de gebruiker om een getal N
N = int(input("Voer een getal N in: "))
priemgetallen = generate_primes(N)
print(f"Priemgetallen tot {N}: {priemgetallen}")