Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddharthChaberia authored Oct 20, 2022
1 parent 1e9d1d3 commit a31289d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions primeplay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import random
from math import sqrt

def primecheck(n):
if n<1:
return False
check=True
for i in range(2,int(sqrt(n))+1):
if n%i==0:
check=False
break
return check

score=0
greets=["GG!","Good Going!","Superb!","Is that all?"]
life=3
print("Try to enter as many prime numbers as many possible, else you loose.. Good Luck :)")
while life:
a=int(input("Enter a integer: "))
if primecheck(a):
score+=1
print(greets[random.randint(0,len(greets))])
else:
life-=1
print("Oops! Remaining life :", life)

print("Well played! You score was :",score)

0 comments on commit a31289d

Please sign in to comment.