Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

absolut beginners projects in python with tutorial

from random import randint

#create a list of play options
t = ["Rock", "Paper", "Scissors"]

#assign a random play to the computer
computer = t[randint(0,2)]

#set player to False
player = False

while player == False:
#set player to True
    player = input("Rock, Paper, Scissors?")
    if player == computer:
        print("Tie!")
    elif player == "Rock":
        if computer == "Paper":
            print("You lose!", computer, "covers", player)
        else:
            print("You win!", player, "smashes", computer)
    elif player == "Paper":
        if computer == "Scissors":
            print("You lose!", computer, "cut", player)
        else:
            print("You win!", player, "covers", computer)
    elif player == "Scissors":
        if computer == "Rock":
            print("You lose...", computer, "smashes", player)
        else:
            print("You win!", player, "cut", computer)
    else:
        print("That's not a valid play. Check your spelling!")
    #player was set to True, but we want it to be False so the loop continues
    player = False
    computer = t[randint(0,2)]
Comment

PREVIOUS NEXT
Code Example
Python :: most occurring string in column pandas 
Python :: override the text in buttons django admin 
Python :: python function to check list element ratio with total data 
Python :: dropdown menu for qheaderview python 
Python :: how to add numbers on top of bar graph in jupyter notebook 
Python :: python is not writing whole line 
Python :: python spamming bot 
Python :: check value vowel user input python 
Python :: python to exe 
Python :: colorama 
Python :: python selenium wait for page to load 
Python :: Python program that takes 2 words as input from the user and prints out a list containing the letters that the 2 words have in common 
Python :: radix sort python 
Python :: how to set screen brightness automatically depending on battery percentage using python 
Python :: qlineedit autocomplete python 
Python :: raatatatatatatatatatatatatatatatatatatatatatatatatatatattatana 
Python :: python get ip info 
Python :: flask docker 
Python :: python tkinter text widget 
Python :: python sort string 
Python :: choosing the correct lower and upper bounds in cv2 
Python :: pandas select column by index 
Python :: Insert numpy array to column 
Python :: python replace newline 
Python :: how to reverse a number in python 
Python :: pt_core_news_sm spacy download 
Python :: numpy take out elements equal to zero 
Python :: df change column names 
Python :: Get value from TextCtrl wxpython 
Python :: use of the word bruh over time 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =