How to code Rock Paper Scissors (Beginner Python Tutorial)

preview_player
Показать описание
Learn how to code rock paper scissors in Python! The perfect game you can play against your computer in quarantine.

In this video, I teach how to set up the logic in rock paper scissors, and how to play against your computer. We start by coding a single game and the win logic behind it. Then, we expand on this idea and write a game of rock paper scissors, best out of n rounds, where n is a number you get to define.

Feel free to leave any questions.

Thanks for watching everyone!
~~~~~~~~~~~~~~~~~~~~~~~~
Рекомендации по теме
Комментарии
Автор

Me:copying all what she did
Also me:im programr

AmjadGD
Автор

I just started learning python and this really helped me understand statements and functions

ryanschmutzler
Автор

Thank you very much, I learned a lot. The "return (0, user, computer)" statement was an eye opener for me. I can see the potential in this.

paraglide
Автор

If Fire and Water are added to this game,
1. Scissors cuts Paper
2. Scissors obstructs Water
3. Paper covers Stone
4. Paper absorbs Water
5. Stone breaks Scissors
6. Stone smothers Fire
7. Fire forges Scissors
8. Fire ignites Paper
9. Water weathers Stone
10. Water douses Fire

blazinggirlkiana
Автор

Hi Kylie, these projects really helping me a lot! You are the big champ!

shinkansen
Автор

import random
option = ['rock', 'paper', 'sci']

n = 0
m = 0
print ("Welcome to Rock-Paper-Scissor!")

while n <= 3 or m <= 3:


userchoice = input("Please enter your choice rock, paper, sci :")
compchoice = random.choice(option)


if userchoice == 'rock' and compchoice == 'sci':
print ("You get a point!")
n += 1
print ("Your points are ", n)

if userchoice == 'paper' and compchoice == 'rock':
print ("You get a point!")
n += 1
print("Your points are ", n)

if userchoice == 'sci' and compchoice == 'paper':
print ("You get a point!")
n += 1
print("Your points are ", n)

if userchoice == 'rock' and compchoice == 'paper':
print ("Opponent gained a point!")
m += 1
print ("Opponent points are ", m)
if userchoice == 'sci' and compchoice == 'rock':
print ("Opponent gained a point!")
m += 1
print ("Opponent points are ", m)
if userchoice == 'paper' and compchoice == 'sci':
print ("Opponent gained a point!")
m += 1
print ("Opponent points are ", m)
if userchoice == compchoice:
print ("Round has tied.")

else:
if n == 3:
print ("You win!")
if m == 3:
print ("You lose!")
break






I did this, but I feel like I could have improved by avoiding the loss lines and using a function instead. Great video, helped me understand a new perspective

Raj_
Автор

Ah my first program (i skipped hello world)

johnuthus
Автор

lmao you said tic tac toe at 8:07, i'm only pointing this out because i was making a rock paper scissors game as well mine is much more basic compared to this one and i kept referring to it as tic tac toe instead of rock paper scissors, good video tho its nice to see other iterations of the same game

pronglebot
Автор

Instead of using random to select a random move, i thought of a strategy that the ai can follow to win. If we have a triangle with rock on top at bottom right the paper and at bottom left the scissors, if we lose from rock we can play the next move on the triangle which is paper and we won! Same for every other move. We can use the random lib to select a first move.

HTWwpzIuqaObMt
Автор

I got a basic from this video. Thank you so much. Best wishes From Bangladesh.

mdmahidurrahman
Автор

GURL....THANK YOU FOR GETTING TO THE POINT.

lordxauce
Автор

This code is super easy to read and your explanation is on point! thank you!!

alucardmax
Автор

Omg you did this way beter than I did. Thanks for showing me there's a way beter way

TIMMMYYYHHH
Автор

Great, short and Simple tutorial, Thank you

Mohamedtarek-qzzj
Автор

Very fun video! Thanks for sharing it!

tmate-jy
Автор

What class did you learn this game program from Kylie ?

BradleyRaines
Автор

I'm a noob and have been teaching myself python through various online resources. I attempted this project as my first solo build. I failed badly and came across this video. Is it normal to feel like I know nothing lol!

john-paulmatenga
Автор

I do not know why, but this code is not working for me, there is a syntax error

.animations
Автор

I’m able to run the program but it isn’t acknowledging a winner, only what the computer chose. I typed everything you did, is there a broader explanation around the losses?

aliway
Автор

3:53 uhmm, I would like to ask about running the script, how did you do that?

Kaori--
welcome to shbcf.ru