DEV Community

Durga Pokharel
Durga Pokharel

Posted on

3 2

Day 8 of 100DaysOfCode: Python Code to Find Out Composite Or Prime Number

This is my 8th day of #100daysofcode . Today I learned more about Cascading style sheets which tell the browser how to display the text and other content that we write in HTML. Also, I tired to write some code regarding to some mathematical problems. Below is my code of the day. Which is used to find composite or prime number.

def prime_or_composit(n):
    f = 0
    for i in range(1,int(n/2)+1):
        if n % i == 0:
            f += 1

    if f >= 2:
        print(f"{n} is composit.")
    else:
        print(f"{n} is prime.")
prime_or_composit(5)
Enter fullscreen mode Exit fullscreen mode

Day 8 of #100DaysOfCode and Python
* Basic CSS
* Python Function
* Code to find out composite or Prime from given number.#CodeNewbie , #beginner , #programming pic.twitter.com/gu1fee6267

— Durga Pokharel (@mathdurga) December 31, 2020

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay