French
Clemylia commited on
Commit
68be1dd
·
verified ·
1 Parent(s): c787ddd

Upload 3 files

Browse files
Files changed (3) hide show
  1. math_package.js +49 -0
  2. science_package.jl +67 -0
  3. string_package.py +65 -0
math_package.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ // Package mathématique en JavaScript pour BzzBee
3
+ // Convention: pollen -> paramètres : miel
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ if (args.length === 0) {
8
+ console.log("🍯 Package Math BzzBee chargé! Fonctions disponibles:");
9
+ console.log("- addition [a] [b]");
10
+ console.log("- soustraction [a] [b]");
11
+ console.log("- multiplication [a] [b]");
12
+ console.log("- division [a] [b]");
13
+ console.log("- modulo [a] [b]");
14
+ console.log("- factorielle [n]");
15
+ process.exit(0);
16
+ }
17
+
18
+ const operation = args[0];
19
+
20
+ function calculate(op, a, b) {
21
+ const numA = parseFloat(a) || 0;
22
+ const numB = parseFloat(b) || 0;
23
+
24
+ switch(op) {
25
+ case 'addition':
26
+ return `🍯 Résultat: ${numA} + ${numB} = ${numA + numB}`;
27
+ case 'soustraction':
28
+ return `🍯 Résultat: ${numA} - ${numB} = ${numA - numB}`;
29
+ case 'multiplication':
30
+ return `🍯 Résultat: ${numA} × ${numB} = ${numA * numB}`;
31
+ case 'division':
32
+ if (numB === 0) return "❌ Division par zéro impossible!";
33
+ return `🍯 Résultat: ${numA} ÷ ${numB} = ${numA / numB}`;
34
+ case 'modulo':
35
+ if (numB === 0) return "❌ Modulo par zéro impossible!";
36
+ return `🍯 Résultat: ${numA} % ${numB} = ${numA % numB}`;
37
+ case 'factorielle':
38
+ if (numA < 0 || !Number.isInteger(numA)) return "❌ Factorielle uniquement pour les entiers positifs!";
39
+ let fact = 1;
40
+ for (let i = 1; i <= numA; i++) fact *= i;
41
+ return `🍯 Résultat: ${numA}! = ${fact}`;
42
+ case 'test':
43
+ return "🍯 Package Math JavaScript testé avec succès!";
44
+ default:
45
+ return `❌ Opération '${op}' non reconnue!`;
46
+ }
47
+ }
48
+
49
+ console.log(calculate(operation, args[1], args[2]));
science_package.jl ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #!/usr/bin/env julia
3
+ # Package scientifique en Julia pour BzzBee
4
+ # Convention: pollen -> paramètres : miel
5
+
6
+ function process_scientific(operation, params...)
7
+ if operation == "pi"
8
+ println("🍯 Résultat: π = ", π)
9
+ elseif operation == "e"
10
+ println("🍯 Résultat: e = ", ℯ)
11
+ elseif operation == "factorielle" && length(params) >= 1
12
+ n = parse(Int, params[1])
13
+ if n >= 0 && n <= 20
14
+ result = factorial(n)
15
+ println("🍯 Résultat: ", n, "! = ", result)
16
+ else
17
+ println("❌ Factorielle supportée pour 0-20 seulement!")
18
+ end
19
+ elseif operation == "fibonacci" && length(params) >= 1
20
+ n = parse(Int, params[1])
21
+ if n > 0 && n <= 50
22
+ fib_seq = [1, 1]
23
+ for i in 3:n
24
+ push!(fib_seq, fib_seq[i-1] + fib_seq[i-2])
25
+ end
26
+ println("🍯 Résultat: Fibonacci(", n, ") = ", fib_seq[n])
27
+ else
28
+ println("❌ Fibonacci supporté pour 1-50 seulement!")
29
+ end
30
+ elseif operation == "prime" && length(params) >= 1
31
+ n = parse(Int, params[1])
32
+ is_prime = n > 1 && all(n % i != 0 for i in 2:isqrt(n))
33
+ println("🍯 Résultat: ", n, is_prime ? " est un nombre premier" : " n'est pas un nombre premier")
34
+ elseif operation == "sqrt" && length(params) >= 1
35
+ x = parse(Float64, params[1])
36
+ if x >= 0
37
+ println("🍯 Résultat: √", x, " = ", sqrt(x))
38
+ else
39
+ println("❌ Racine carrée d'un nombre négatif impossible!")
40
+ end
41
+ elseif operation == "log" && length(params) >= 1
42
+ x = parse(Float64, params[1])
43
+ if x > 0
44
+ println("🍯 Résultat: ln(", x, ") = ", log(x))
45
+ else
46
+ println("❌ Logarithme d'un nombre négatif ou nul impossible!")
47
+ end
48
+ elseif operation == "test"
49
+ println("🍯 Package Julia BzzBee testé avec succès!")
50
+ else
51
+ println("""🐝 Package Science Julia BzzBee - Fonctions disponibles:
52
+ - pi
53
+ - e
54
+ - factorielle [n]
55
+ - fibonacci [n]
56
+ - prime [n]
57
+ - sqrt [x]
58
+ - log [x]
59
+ - test""")
60
+ end
61
+ end
62
+
63
+ if length(ARGS) > 0
64
+ process_scientific(ARGS...)
65
+ else
66
+ println("🍯 Package Science Julia chargé! Utilisez: pollen -> commande params : miel [jl science_package.jl]")
67
+ end
string_package.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #!/usr/bin/env python3
3
+ # Package de manipulation de chaînes en Python pour BzzBee
4
+ # Convention: pollen -> paramètres : miel
5
+
6
+ import sys
7
+ import re
8
+
9
+ def process_string(operation, text="", extra=""):
10
+ """Traite les opérations sur les chaînes de caractères"""
11
+
12
+ if operation == "majuscule":
13
+ return f"🍯 Résultat: '{text}' -> '{text.upper()}'"
14
+
15
+ elif operation == "minuscule":
16
+ return f"🍯 Résultat: '{text}' -> '{text.lower()}'"
17
+
18
+ elif operation == "inverse":
19
+ return f"🍯 Résultat: '{text}' -> '{text[::-1]}'"
20
+
21
+ elif operation == "longueur":
22
+ return f"🍯 Résultat: Longueur de '{text}' = {len(text)}"
23
+
24
+ elif operation == "mots":
25
+ words = text.split()
26
+ return f"🍯 Résultat: '{text}' contient {len(words)} mots"
27
+
28
+ elif operation == "remplacer":
29
+ if not extra:
30
+ return "❌ Paramètre manquant pour remplacer!"
31
+ result = text.replace(extra, "★")
32
+ return f"🍯 Résultat: '{text}' -> '{result}' ('{extra}' remplacé par ★)"
33
+
34
+ elif operation == "palindrome":
35
+ clean_text = re.sub(r'[^a-zA-Z0-9]', '', text.lower())
36
+ is_palindrome = clean_text == clean_text[::-1]
37
+ return f"🍯 Résultat: '{text}' {'est' if is_palindrome else 'n\\'est pas'} un palindrome"
38
+
39
+ elif operation == "voyelles":
40
+ vowels = "aeiouAEIOU"
41
+ count = sum(1 for char in text if char in vowels)
42
+ return f"🍯 Résultat: '{text}' contient {count} voyelles"
43
+
44
+ elif operation == "test":
45
+ return "🍯 Package String Python testé avec succès!"
46
+
47
+ else:
48
+ return f"""🐝 Package String BzzBee - Opérations disponibles:
49
+ - majuscule [texte]
50
+ - minuscule [texte]
51
+ - inverse [texte]
52
+ - longueur [texte]
53
+ - mots [texte]
54
+ - remplacer [texte] [ancien]
55
+ - palindrome [texte]
56
+ - voyelles [texte]"""
57
+
58
+ if __name__ == "__main__":
59
+ if len(sys.argv) == 1:
60
+ print(process_string("help"))
61
+ else:
62
+ operation = sys.argv[1] if len(sys.argv) > 1 else ""
63
+ text = sys.argv[2] if len(sys.argv) > 2 else ""
64
+ extra = sys.argv[3] if len(sys.argv) > 3 else ""
65
+ print(process_string(operation, text, extra))