Skip to content

Commit

Permalink
Added a folder P11-PapunCharan
Browse files Browse the repository at this point in the history
The folder contains two files numbers-guess.py and rock-paper-scissors.py
  • Loading branch information
richard937 authored Jul 6, 2019
1 parent 3f485da commit 7e6d68f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
34 changes: 34 additions & 0 deletions P11-Papun Charan/number-guess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#number game
import random

print("This is the Higher Lower Guessing Game, where you have to guess a number and we will check how well you can guess")


def play():
gen = random.randint(1, 100)
#print(gen)

gus = 0
tri = 0

while gus != gen:
gus = int(input("Guess a nummber: "))
tri = tri + 1
if gus > gen:
print("you need to guess lower, try again ")
elif gus < gen:
print("you need to guess higher, try again ")
else:
print("Congrats, you guessed it correct and You took " + str(tri) + " guesses to reach to the correct number")
print("If you want to continue enter 1 and if you want to exit enter 0")
x = int(input())
return (x)



p =1
while(True):
if p==0:
break
else:
p = play()
37 changes: 37 additions & 0 deletions P11-Papun Charan/rock-paper-scissor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#Rock Paper Scissors Game

import random
options =["rock", "paper", "scissors","rock", "paper", "scissors","rock", "paper", "scissors"]
print("Welcome to Rock Paper Scissors Game")

play = "yes"
coscore=0
myscore=0
while play == "yes":
comove= random.choice(options)
mymove = input("What will you choose? rock, paper or scissors: ")
print("Computer choose ", comove)
if mymove==comove:
print("it's a tie")
elif mymove=="scissors" and comove=="rock":
print("Computer wins")
coscore = coscore + 1
elif mymove == "scissors" and comove == "paper":
print("Player wins")
myscore = myscore+1
elif mymove=="paper" and comove=="rock":
print("Player wins")
myscore = myscore+1
elif mymove=="paper" and comove=="scissors":
print("Computer wins")
coscore = coscore + 1
elif mymove=="rock" and comove=="paper":
print("Computer wins")
coscore = coscore+1
elif mymove=="rock" and comove=="scissors":
print("Player wins")
myscore = myscore+1
print("Your score is: ",myscore)
print("Computer's score is: ",coscore)
print("Do you want to play agin: yes/no")
play = input()

0 comments on commit 7e6d68f

Please sign in to comment.