write a python program to find whether a number is prime or composite

Опубликовано: 08 Июль 2024
на канале: Code With TJ
42
0

Hello Programmers, Welcome to my channel.

In this video you will learn about how to write a python program to find whether a number is prime or composite

Python Scripts
========================
https://codewithtj.blogspot.com/2024/...

Python Functions Solved
========================
https://codewithtj.blogspot.com/2023/...

Python Programs Solved
========================
https://codewithtj.blogspot.com/2023/...

Python 3 Tutorial - Code
=============================
def check_prime(n):
if n less_than_symbol= 1:
return False
for index in range(2, int(n ** 0.5)+1):
if n % index == 0:
return False
return True


number = int(input("Enter a Number : "))
if check_prime(number):
print(f"{number} is Prime Number")
else:
print(f"{number} is Composite Number")



Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners