Creating a "Basic" Python Code: RPSLSUD

Link to 'Presentation'.'

Step One: Download+Install Python
Step Two: Code your code:

Definitions:

Global: Global designates a variable that persists throughout the entirety of your code, including individual scenes/commands.

Print: Print tells Python to say something on the screen for the user to read. It is, in a sense, the GUI. An example code would be:
print ("I refuse to eat that cabbage.")

Def: Def stands for Define. When def is used, it is used to define a variable. Very important. An example code would be: def Cabbage():

If: If is a command that checks if something is correct. An example code would be: If a = b print ("Hello!")

Then: Then works in conjunction with If. An example of code would be: If a = b Then c = d

Elif: Elif stands for Else If. Else if is used if an If/Then statement is false. An example code would be: If command = Rock Print ("No!")
Elif command = Paper Print ("Yes!")
Prompt: Prompt activates if a specific requirement is fufilled.

Red Code: If the code is red, that means that it will not be included in the final running process.
elif: If the red code is underlined and highlighted, that means you have an error!


The actual code:


global h

h = 0


global a

a = "Rock"


global b

b = "Paper"


global c

c = "Scissors"


global score1

score1 = 0


global score2

score2 = 0
def start():

print("YOUR WELCOME TEXT HERE")

start2()
def prompt():

x = input("YOUR CHOICE TEXT HERE ")

return x
def prompt2():

x = input("YOUR COMMAND TEXT HERE ")

return x
def prompt3():

x = input("YOUR PLAY AGAIN TEXT HERE ")

return x
def rand():

global h

import random

h=(random.choice([a,b,c]))

print(h)
def info():

print("YOUR INFO TEXT HERE")

start2()
def play():

global h

global score1

global score2

command = prompt()

if command == "Rock" or command == "rock":

rand()

if (h == a):

print("Tie!")

elif (h == b):

print("You Lose!")

score2 = score2 + 1

elif (h == c):

print("You Win!")

score1 = score1 + 1

else:

print("Error something bad happened")

play()

elif command == "Paper" or command == "paper":

rand()

if (h == b):

print("Tie!")

elif (h == c):

print("You Lose!")

score2 = score2 + 1

elif (h == a):

print("You Win!")

score1 = score1 + 1

else:

print("Error!")

play()

elif command == "Scissors" or command == "scizors" or command == "Scizors" or command == "scissors":

rand()

if (h == c):

print("Tie!")

elif (h == a):

print("You Lose!")

score2 = score2 + 1

elif (h == b):

print("You Win!")

score1 = score1 + 1

else:

print("Error!")

play()

else:

print("Error, unrecognised command")

print("Choose either Rock, Paper, Scissors, Lizard, Spock, Dwarf, or Unicorn")

print("Note: You can also type 'points' or 'score'")

play()


def start2():

command = prompt2()

if command == "info" or command == "help":

info()

elif command == "play" or command == "Play":

play()

elif command == "score" or command == "rock" or command == "Rock" or command == "paper" or command == "Paper" or command == "Scizors" or command == "scizors" or command == "Scissors" or command == "scissors":

print("Command currently unavailable. Type 'play' first")

start2()

else:

print("YOUR ERROR COMMAND HERE")

start2()

start()