Share your repls and programming experiences

← Back to all posts
bigdick123 (1)

im a begineer with your mum

ItsHarryPotter (1)

@bigdick123 your a beginner at school as well

gcmuehlbacher (0)

use a random number generator and then assigning these number add input ability from the human

brmcatee (2)

You need to ask for an actual input to the user by using (variable) = input('Choose your move)
then do your if statements

tuprig (0)

gg its pretty good :D

RickyKuang (0)

boi it's just an error cmon now

RaenonX (0)

learn some method comes from random module and learn some conception about enum, you may find your code very short, No need any if :D

jonathontucker (0)

Do you just copy and paste the link? getting a lot of 404's

s749526 (0)

does nothing but say computer won...

EpicGamer425 (9)

Good program! But could you change it from changing the code itself, to having an input() statement?

RyanBridgforth (0)

I just started the program, clicked run, and this happened.

ChrisJantzen (2)

@ryanbridgforth: It's because the choices are hard coded in instead of allowing for input.

ZSiegel (0)

Shortened version with randomized choices for both players

StellaDrinkh2o3 (0)

Your game was inspiring. I hop you don't mind that I made my own version. I added a randomized computer answer and an input option for the human.


you can input from user

the_tootoo_guy (4)

amzing idea but it would be cool to randomly generated computer answer

jraokmepala (0)

@davidpython3 As far as I can tell, you need to actually have input. The computer always wins.

human_choice = input("What is your move?").lower

Sorry, I don't know how to put it in a code block.

jraokmepala (0)

@davidpython3: Sorry, that was Ruby. I fixed it.

BobJoeIII (20)

Use input, and make the computer choice random. Does this even count as a game if you automatically win?

glendog (1)


Rather than hard code the choices, why not have an input from the user for their choice and a random number which dictates the computers choice.

Govind05 (1)

@glendog: I agree . @davidpython3 if you use the user input it may be some what difficult for a beginner but the game will be good.

Carson08 (3)

@glendog: I agree. you can do this with input("What do you choose?")

Also, for the "draw" portion of the game code, instead of using And,you can use ==. Like this:

if human_choice == computer_choice:
print("blah blah blah")

To do the random choice is a bit harder.It took me awhile to find online when I wanted to do it. You will need to Import Random at the start of your code (import Random). It is an automatic module.

You will then use x = random.randit(1,3) to chose a number 1-3. Then:
if x == 1:
computer_choice = rock
elif x == 2
computer_choice == scissors

Nice job! if you are looking for fun projects, i would do Guess A Number! like they guess then Too Small! then they guess Too Big! ect.

Ihope this helped you on your coding career!!!

LightninMcQuade (41)

@carson08: I really like your suggestion so I made it into a program!

brmcatee (2)

@quadeg1: try adding error checks so the user can't enter an invalid statement like ppaper. Make a loop so it asks again if the input is incorrect :D

CyanCoding (2144)

@quadeg1: I like your Rock Paper Scissors program! I made one (\) that I created on (the reason I don't link you to the actual repl is because it only got part of the job and I had to use my server for the rest).

LightninMcQuade (41)

@microwither: I played it that's super cool!

CyanCoding (2144)

@quadeg1: Thanks! Also, I love your 10 day forecast program. That's really smart :)

LightninMcQuade (41)

@microwither: It was an assignment for class lol to get us familiar with web scraping

leomessiah10 (0)

u can do a lot to improve this program....being a beginner......though...think over making it more user freindly

SlimxShady (0)

Hey man! Great for a beginner, but there is still so much more you can do with this! I recommend doing Codecademy's Python course: I am almost done the course and it is quite good at teaching the language! It is all interactive coding as well, so you pick up on it quite fast! As others said, you can make the computers choice randomized, and add user input to allow the user to choose an option instead of hard coding their choice in for them!

ChrisReddersen (2)

No input(). Hit run, the program simply jumps to "the computer won!" line. tried a few things, but th

create (0)

it does not work

17063381 (0)

Try randomly generating a number (I beleive you can import this function) between 1 and 3 - and assign 1, 2 and 3 to ROCK, PAPER and SCISSORS - to pick the computers go and then ask the user for an input using
UserChoice = str(input()).