From 0ae58f912ead0a994d6d5b79f34c3d5b231fd0ec Mon Sep 17 00:00:00 2001 From: creepygal Date: Mon, 5 Oct 2020 18:00:09 +0500 Subject: [PATCH 1/2] added file --- sqrroot.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sqrroot.py diff --git a/sqrroot.py b/sqrroot.py new file mode 100644 index 0000000..b21a9f3 --- /dev/null +++ b/sqrroot.py @@ -0,0 +1,7 @@ + +a=eval(input("Enter the value of a:")) +b=eval(input("Enter the value of b:")) +c=eval(input("Enter the value of c:")) +x1=(-b+(b**2-4*a*c)*0.5)/2*a +x2=(-b-(b**2-4*a*c)*0.5)/2*a +print(x1,x2) From 03caea6c9d37fcdf0dc322347d473a9375bd1109 Mon Sep 17 00:00:00 2001 From: creepygal Date: Tue, 6 Oct 2020 15:50:41 +0500 Subject: [PATCH 2/2] Doc: --- rock-paper-scissor.py | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 rock-paper-scissor.py diff --git a/rock-paper-scissor.py b/rock-paper-scissor.py new file mode 100644 index 0000000..d969739 --- /dev/null +++ b/rock-paper-scissor.py @@ -0,0 +1,44 @@ +#first we'll import random library to generate random numbers for the game +import random + +#initiating the values +userWins=0 +compWins=0 +draw=0 + +#defining the while loop +while userWins<3 and compWins<3: + #keep taking the inputs from the user + user=eval(input("scissor(0), rock(1), paper(2):")) + comp=random.randint(0,2) + + #Conversion of the number into a string + if user==0: + u="scissor" + elif user==1: + u="rock" + else: + u="paper" + + #Conversions for the computer + if comp==0: + c="scissor" + elif user==1: + c="rock" + else: + c="paper" + +#choosing the winners + if user==(comp+1)%3: + print("The computer is " +c+" You are "+u+". You won! Congrats!.\n") + userWins+=1 + elif user==(comp-1)%3: + print("The computer is " +c+" You are "+u+". You lose... Computer won!.\n") + compWins+=1 + else: + print("The match has drawed... Both you and the computer are "+u+".Better try again.\n") + draw+=1 + +totalGames=userWins+compWins+draw +print("Game Ended..... You won ",userWins," times out of",totalGames) +