All solutions to problems must be formalized in the form of appropriate functions. Data input and output should be carried out in the main part of the program. Data input and output are performed through standard input/output streams.
Check if the number is prime.
Input:
Enter one natural number n not exceeding 2000000000 and not equal to 1.
Output:
You need to print the string prime if the number is prime, or composite if the number is composite.
Examples:
input data - 5
output - prime
input data - 6
output - composite
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
This course guides you through the fundamentals of Python programming using an interactive Python library known as Turtle.
This course encompasses a range of Geometry topics such as coordinate and spatial geometry, introductory trigonometry, angles, parallel lines, congruent and similar triangles, polygons, circles, the Pythagorean Theorem, and more. Emphasis will be placed on reinforcing Algebra skills and enhancing critical thinking through problem-solving in both mathematical and real-world contexts.
Ask about our courses and offerings, and we will help you choose what works best for you.