Ad
Mathematics
Algorithms
Logic
Numbers
Code
Diff
  • function prime_checker (n) {
      if (n === 1 || n === 0) return false;
      for(let i = 2; i < n; i++) {
        if(n % i === 0) return false;
      }
      return true;  
    }
    
    • import math
    • def prime_checker(n):
    • if n == 1:
    • return False
    • max_divisor = math.floor(math.sqrt(n))
    • for d in range(2, 1 + max_divisor):
    • if n % d == 0:
    • return False
    • return True
    • function prime_checker (n) {
    • if (n === 1 || n === 0) return false;
    • for(let i = 2; i < n; i++) {
    • if(n % i === 0) return false;
    • }
    • return true;
    • }
Code
Diff
  • def Hello_Python(a='Hello',b='Python!'):
        return a + b
    • System.Console.WriteLine("Hello, C#!");
    • def Hello_Python(a='Hello',b='Python!'):
    • return a + b
Code
Diff
  • def add(a=0,b=0):
        return float(abs(a) + abs(b))
    • def add(a, b):
    • return (a**2-b**2)//(a-b)
    • def add(a=0,b=0):
    • return float(abs(a) + abs(b))