import random
computer_choice = random.choice(["rock", "paper", "scissors"])
user_choice = input("rock, paper, or scissors? ")
if computer_choice == user_choice:
print("It's a draw!")
elif user_choice == "rock" and computer_choice == "scissors":
print("You win!")
elif user_choice == "paper" and computer_choice == "rock":
print("You win!")
elif user_choice == "scissors" and computer_choice == "paper":
print("You win!")
else:
print("The computer wins!")
I wrote my code in python 3.8. I hope this helps.
Program Pseudocode graphically present the detailed sequence of steps needed to solve a programming problem.
<h3>What are Pseudocode?</h3>
These are known to be a set of codes that a program has graphically depicted all of its sequence of steps that can be sued to handle a programming problem.
Note that Pseudocode is a form of artificial and man made informal language that is often used by programmers to create algorithms.
Learn more about Program from
brainly.com/question/153827
#SPJ1
Python Code:
class Dog:
""" Dog class definition """
# data attribute species as part of the class Dog
species = "Canis familiaris"
def __init__(self, _name, _breed):
""" Constructor """
# Assigning values
self.name = _name
self.breed = _breed
self.tricks = []
def teach(self, trick):
""" add a passed string parameter to tricks """
# Adding to list
self.tricks.append(trick)
# Printing message
print(self.name + " knows " + trick)
def knows(self, chkStr):
""" check whether a passed string parameter is in the dog’s list of tricks """
# Checking in tricks list
if chkStr in self.tricks:
# Printing message
print("Yes, " + self.name + " knows " + chkStr)
else:
# Printing message
print("No, " + self.name + " doesn't know " + chkStr)