Answer to Question #224929 in Python for Hari nadh babu

Question #224929

First Prime Number


This Program name is First Prime Number. Write a Python program to First Prime Number, it has two test cases


The below link contains First Prime Number question, explanation and test cases


https://docs.google.com/document/d/1VyIWTfBFSXtNuAtIzk9bDqD_q3cMl1sU/edit?usp=sharing&ouid=107231566038157986423&rtpof=true&sd=true


We need exact output when the code was run

1
Expert's answer
2021-08-11T07:29:19-0400


def is_prime(n):
    Flag=1
    if n <=1:
        Flag=0
    else:
        for i in range(2, n):
            if n % i == 0:
                Flag=0
    if(n==2): Flag=0
    return(Flag)


N = int(input("Enter N = "))
Nums = []
Flag=0
k=0
for r in range(0,N):
    t = int(input())
    Nums.append(t)
    if(Flag==0):
        Flag=is_prime(t)
        k = t


if(Flag):
    print("First Prime Number = ",k)
else:
    print("There is no prime number in the list")





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS