Python Project 1 | Rock Paper Scissors Game in Python | Python for Beginners #lec39

preview_player
Показать описание
Coding Rock, Paper Scissors Game in Python. This tutorial will teach you how to develop the rock, paper & scissors game using Python programming. This is our First Project in this Python Tutorial Series

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #pythonforbeginners #python #jennyslectures #pythonprogramming
Рекомендации по теме
Комментарии
Автор

rock = '🪨'
paper = "📃"
scissors = '✂'
gameIcons = [rock, paper, scissors]
import random
choice = [0, 1, 2]
compChoice = random.choice(choice)
userChoice = int(input('What is your choice 0-rock, 1-paper & 2- Scissors? '))
if userChoice < 0 or userChoice > 2:
userChoice = int(input('Please make a valid choice.0-rock, 1-paper & 2- Scissors: '))
# To improve use loop function?
if compChoice == userChoice:
print('You have a draw. Click to play again.')
elif userChoice == 0 and compChoice == 2:
print('You win')
elif compChoice == 0 and userChoice == 2:
print('You lose!')
elif compChoice > userChoice:
print('You lose. Click enter to play another round')
else:
print('You win.')
print(f'Computer chooses, {gameIcons[compChoice]}')
print(f'You choose, {gameIcons[userChoice]}')

kenshampton
Автор

import random
user=int(input("enter your number where 0 for rock, 1 for paper, 2 for scissor:"))
if user<0 or user>2:
print("enter a valid number")
else:
print("start and enjoy the game!")
computer=random.randint(0, 2)
print(f"computer selected number is {computer}")
if user==computer:
print("The game is a tie and play again")
elif user==0 and computer==1 or user==1 and computer==2 or user==2 and computer==0:
print("computer won the game!")
else:
print("user won the game!")
print("Thank You")

SravaniGrandhisila
Автор

I have completed my graduation, now I'm a full-time software engineer.
But everytime I get a notification that jenny ma'am has uploaded a video I'm like, it's time to learn a bit more and melt again.

*Love you Jenny ma'am* 👉🥺👈

maifeeulasad
Автор

import random


y = int(input("Enter option: "))
c = random.randint(4, 6)
if y==1 :
if c==5:
print("You loose computer has chosen paper")
elif c==6:
print("You win computer has chosen scissor")
else:
print("Play again")
elif y==2 :
if c==4:
print("you win computer has chosen rock")
elif c==6:
print("you loose computer has chosen scissor")
else:
print("Play again")
elif y==3:
if c==4:
print("you loose computer has chosen rock")
elif c==5:
print("you win computer has chosen paper")
else:
print("Play again")
else :
print("Choose correct option")

nirvikdutta
Автор

logic is everything man, now i understand, thanks for the whiteboard explanation.

cugansteamid
Автор

Its great time to see such brain trainer videos in programming, have great time mam, A big❤❤ Thank you for you for making easy such python concept.

theperspective
Автор

import random
input("Start Play (rock, paper, scissor)")
a = input("Enter Your Choise: ")
b = ["rock", "paper", "scissor"]
c = random.choice(b)
print(f"you choise {a} and computer choise {c}")
if a == c:
print("Tie")
elif a == "rock":
if c == "paper":
print("you lose")
else:
print("you Won")
elif a == "paper":
if c == "scissor":
print("you lose")
else:
print("you won")
elif a == "scissor":
if c == "rock":
print("you lose")
else :
print("you won")
else:
print("Your choise is invailid")

mrpashabook
Автор

import random
choose = int(input("enter 0 for rock, 1 for paper and 2 for scissor"))
x=random.randrange(0, 2)
print(x)
if(choose == x):
print("draw")
elif(choose == 0 and x == 1 or choose == 1 and x == 0):
print("Paper win")
elif(choose == 0 and x == 2 or choose == 2 and x == 0):
print("Rock win")
elif(choose == 2 and x == 1 or choose == 1 and x == 2):
print("Scissor win")
else:
print("wrong input")

nandinidubey
Автор

import random
u=int(input("enter the choice, 0-rock, 1-paper, 2-scissor:"))
a=random.randint(0, 2)
print(a)
if u==a:
print("A draw")
elif u>a and u-a==1:
print("You won")
elif u>a and u-a==2:
print("You lost")
elif u<a and a-u==1:
print("You lost")
elif u<a and a-u==2:
print("You won")

tvujhbh
Автор

You can specifically look for the combination in which user wins and put the computer wins in else it works fine for me and is turbo fast

midnightphantom
Автор

Always love for Jenny ma'am explanations ❤

upendra
Автор

import random
user_choice = (input('Enter 0 for rock and 1 for paper and 2 for scissor: '))
print('user_choice is '+ user_choice)
user_choice = int(user_choice)
computer_choice = random.randint(0, 2)
print('computer_choice is '+str(computer_choice))
if user_choice<=2 and computer_choice<=2:
if user_choice == 0 and computer_choice == 2:
print('User wins')
elif user_choice == 2 and computer_choice ==0:
print('user wins')
elif computer_choice > user_choice:
print('computer wins')
elif user_choice > computer_choice:
print('user wins')
elif user_choice == computer_choice:
print('Drop')
else:
print('invalid choice')

JabeenTaj
Автор

Mam please continue the c++ course also ❤️

tuhinghosh
Автор

import random

userinput=int(input("enter a number between 0 to 2: "))
computerinput=random.randint(0, 2)
print(computerinput)
if userinput==0 or userinput==1 or userinput==2:
if (userinput==0 and and and computerinput==1):
print("user wins")
elif (userinput==0 and and and computerinput==2):
print("computer wins")
elif userinput==computerinput:
print("it is a tie")
else:
print("the input you entered is invalid, PLEASE ENTER VALUE BETWEEN 0 AND 2")

nithinvasamsetti
Автор

import random
Computer_choice=random.randint(0, 2)
user_choice=int(input("Enter Your Choice in numbers\nrock=0 \npaper=1 \nscissor=2 :"))
print(f"Computer chose {Computer_choice}")

print("The game is Draw")
elif(Computer_choice==0 and user_choice==1):
print("You won the game.. ")
elif(Computer_choice==0 and user_choice==2):
print(" Computer won the game")
elif(Computer_choice==1 and user_choice==0):
print("computer won the game")
elif(Computer_choice==1 and user_choice==2):
print("You won the game")
elif(Computer_choice==2 and user_choice==0):
print("You won the game")
elif(Computer_choice==2 and user_choice==1):
print("Computer Won the game")
else:
print("Enter the valid number")

rtcreations
Автор

thank you soo much ma'am, once upon i used to hate coding because i never understood after i have taken many other courses on python but i was unable to understand and write code on my own. But after watching your lectures i can write all the exercise code and even think alternate methods without seeing u solutions. now i feel confident about coding.
i have written this code also without seeing
import random
print('lets play rock paper
print()
u=int(input('rock paper scissors enter your input '))
c=random.randint(0, 2)
print(f'computer choose {c}')
if u > 2 or u < 0:
print('correct input toh de\n tuu har gaya')
elif u == c:
print('Bhai DRAW hogaya fir se khel')
elif u == 0 and c == 2:
print('YOU
elif u == 2 and c == 0:
print('YOU
elif c > u:
print('YOU
elif u > c:
print('YOU

rnqlytb
Автор

It has been a long time!

But the great thing is you are eventually back🙏🙏😀

manfredmasiko
Автор

Kindly upload all topics in python asap mam. Your teaching is really helpful for python beginners....😊
Thanks in advance....

chandrasekar.r
Автор

import random
user_choice=int(input("enter your choice: type 0 for rock, 1 for paper, 2 sissors"))
if user_choice >= 3 or user_choice < 0:
print("invalid number")

else:
computer_choice=random.randint(0, 2)
print("computer chose")
print(computer_choice)
if computer_choice == user_choice:
print("its a draw")

elif computer_choice == 0 and user_choice == 2:
print("you loose")

elif computer_choice == 2 and user_choice== 0:
print("you win")


elif computer_choice == 0 and user_choice == 1:
print("you win")

elif computer_choice == 1 and user_choice == 0:
print("you loose")

elif computer_choice == 1 and user_choice == 2:
print("you win")

elif computer_choice == 2 and user_choice == 1:
print("you loose")

vibhavxs
Автор

import random
option=['Rock', 'Paper', 'Scissor']
print(option)
user=int(input("Enter your Choice: "))
comp=random.randint(1, 3)
print(option[user-1], "is User's Choice")
print(option[comp-1], "is Computer's Choice")
if user==comp:
print("It's draw")
elif user==1 and comp==3:
print("You Win")
elif user==3 and comp==1:
print("You Lose")
elif user>comp:
print("You Win")
elif comp>user:
print("You Lose")
else:
print("Please enter valid option")

snehakumari