Write a program to check for prime number?
Answer / Raisuddin Khan
Here is a simple way to check if a number is prime: def is_prime(n): if n <= 1: return False elif n <= 3: return True else: for i in range(2, int(n**0.5) + 1): if n % i == 0: return False return Truennis_prime(7)
| Is This Answer Correct ? | 0 Yes | 0 No |
How does Python’s list.sort work at a high level? Is it stable? What’s the runtime?
What is the language from which Python has got its features or derived its features?
Can you hack with python?
What is the use of dictionary in python?
How many functions are in python?
What is the use of ‘self’ keyword in python?
What is data type set in python and how to work with it?
Is java or python better?
What can I create with python?
Is python a single inheritance?
What is singleton class in python?
What does [::-1} do?