### Aktualisieren prime/rest.py

parent b98c34f8
 ... ... @@ -41,27 +41,11 @@ def number(number): n = int(number) divisors = lookup(n) if divisors: return f"random { n } is not a prime number. It can be divided by {divisors} (from cache)" return f"{ n } is not a prime number. It can be divided by {divisors} (from cache)" divisors = [i for i in range(2, n) if n % i == 0] cache(n, divisors) if divisors: return f"random { n } is not a prime number. It can be divided by {divisors} (processed)" return f"Yes! random { n } is a prime number." except Exception as ex: log.error(f"Exception: { ex }") abort(500, f"random { n } could not be processed") @app.route("/random") def random(): n = randint(10000000, 10001000) try: divisors = lookup(n) if divisors: return f"random { n } is not a prime number. It can be divided by {divisors} (from cache)" divisors = [i for i in range(2, n) if n % i == 0] cache(n, divisors) if divisors: return f"random { n } is not a prime number. It can be divided by {divisors} (processed)" return f"{ n } is not a prime number. It can be divided by {divisors} (processed)" return f"Yes! random { n } is a prime number." except Exception as ex: log.error(f"Exception: { ex }") ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment