I just created my first python program

Sexually Disabled

Sexually Disabled

aspiring pornstar with ED
Joined
Apr 9, 2022
Posts
9,636
Reputation
10,690
Python:
# Project 1: Rock paper scissors#
import random
import numpy

PlayChoice = 0
ComChoice = 0
score = 0
RoundNo = int(input("Select the number of rounds: "))

for i in range(RoundNo):
    PlayChoice = input(("Pick R Rock, Paper P, Scissors S: ")
    mylist = ["R","P","S"]
    ComChoice = random.choice(mylist)
#Rock variants
    if PlayChoice == "R" and ComChoice == "R":
        print ("We both chose Rock")
        score += 0
    elif  PlayChoice == "R" and ComChoice == "P":
        print ("I chose Rock, you win")
        score += 1
    elif  PlayChoice == "R" and ComChoice == "S":
        print ("I chose Rock, I win")
        score -= 0
#Paper variants
    elif  PlayChoice == "P" and ComChoice == "R":
        print ("I chose Paper, I win")
        score -= 0
    elif  PlayChoice == "P" and ComChoice == "P":
        print ("We both chose Paper")
        score += 0
    elif  PlayChoice == "P" and ComChoice == "S":
        print ("I chose Paper, you win")
        score += 1
#Scissors variants
    elif  PlayChoice == "S" and ComChoice == "R":
        print ("I chose Scissors, you win")
        score += 1
    elif  PlayChoice == "S" and ComChoice == "P":
        print ("I chose Scissors, lose win")
        score -= 0
    elif  PlayChoice == "S" and ComChoice == "S":
        print ("We both chose Scissors")
        score += 0
    else:
        break
print("Game over, you won ",score,"/",RoundNo,".")

How to get good at this shit fellow niggacels?
 
  • +1
Reactions: Jason Voorhees and PlayersGetPlayed
Just pay the ai to do it for u
 
  • +1
Reactions: Lost_Soul, Nick.Harte and PlayersGetPlayed
@thecel how do I get good at this shit nigga?
 
Python:
# Project 1: Rock paper scissors#
import random
import numpy

PlayChoice = 0
ComChoice = 0
score = 0
RoundNo = int(input("Select the number of rounds: "))

for i in range(RoundNo):
    PlayChoice = input("Pick R Rock, Paper P, Scissors S: ")
    mylist = ["R","P","S"]
    ComChoice = random.choice(mylist)
#Rock variants
    if PlayChoice == "R" and ComChoice == "R":
        print ("We both chose Rock")
        score += 0
    elif  PlayChoice == "R" and ComChoice == "P":
        print ("I chose Paper, you win")
        score += 1
    elif  PlayChoice == "R" and ComChoice == "S":
        print ("I chose Scissors, you win")
        score += 1
#Paper variants
    elif  PlayChoice == "P" and ComChoice == "R":
        print ("I chose Rock, you win")
        score += 1
    elif  PlayChoice == "P" and ComChoice == "P":
        print ("We both Paper")
        score += 0
    elif  PlayChoice == "P" and ComChoice == "S":
        print ("I chose Scissors, I win")
        score += 0
#Scissors variants
    elif  PlayChoice == "S" and ComChoice == "R":
        print ("I chose Rock, I win")
        score -= 0
    elif  PlayChoice == "S" and ComChoice == "P":
        print ("I chose Paper, you win")
        score += 1
    elif  PlayChoice == "S" and ComChoice == "S":
        print ("We both chose Scissors")
        score += 0
    else:
        break
print("Game over, you won ",score,"/",RoundNo," rounds.")
fixed it
 
good luck picking food from garbage in 5 years programmercel
 
  • JFL
Reactions: Sexually Disabled
. I would personally just do it with switch cases or a do-while loop and divide it into functions to improve readability and also implement some kind of error handling for false inputs. Numpy import also seems unnecessary. Otherwise the code seems fine once OP has a bit of experience he can learn more about vectorization techniques to perform operations on entire arrays on more complex large dataset problems , rather than element-by-element that but for simple problems small sample set problmes like these it's fine. He has plenty of time to learn these things.
@Jason Voorhees
 
Last edited:
  • +1
  • Love it
Reactions: Sexually Disabled and Nick.Harte

Similar threads

mug
Replies
7
Views
111
incel194012940
incel194012940
Nazi Germany
Replies
22
Views
305
Favelacel
Favelacel
irrumator praetor
Replies
29
Views
605
Cristiano RonaIdo
Cristiano RonaIdo
Xangsane
Replies
102
Views
6K
notsocommonthumb
notsocommonthumb

Users who are viewing this thread

Back
Top