From 900da1cb36707ad72dd0c56b2b70c71e7cea8e62 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:38:37 +0530 Subject: [PATCH] Update mathgen.py --- mathgen.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/mathgen.py b/mathgen.py index 0496c70..b0a426a 100644 --- a/mathgen.py +++ b/mathgen.py @@ -1,16 +1,23 @@ -def isprime(max_a = 100): +#!/usr/bin/python +# -*- coding: utf-8 -*- + + +def isprime(max_a=100): a = random.randint(2, max_a) problem = a if a == 2: solution = True - return problem, solution - if a%2 == 0: + return (problem, solution) + if a % 2 == 0: solution = False - return problem,solution - for i in range(3, (a//2)+1, 2): - if a%i == 0: + return (problem, solution) + for i in range(3, a // 2 + 1, 2): + if a % i == 0: solution = False - return problem, solution + return (problem, solution) solution = True - return problem, solution -is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime) + return (problem, solution) + + +is_prime = Generator('isprime', 74, 'a any positive integer', + 'True/False', isprime)