Question: 1. Rock-paper-scissors Two players (or one player and the computer) each pick one of three possible items (rock, paper, or scissors); both show their choice;

1. Rock-paper-scissors

Two players (or one player and the computer) each pick one of three possible items (rock, paper, or scissors); both show their choice; and the winner is decided by three rules: rock crushes scissors, scissors cut paper, paper covers rock.

To simulate this game, create a list of choices (like colors when created spirals) and use random.choice() to pick one of the three items from the list as the computer's choice. Then ask the user for their choice and use a series of if statements to determine the winner. The user will be playing against the computer.

2. Here's a program that draws random smileys. RandomSmileys.py

Modify this program in 3 different ways of your choice: you can change colors of these smileys, you can draw them upside down, you can add a tongue or a nose, you can make a sad face emoji, etc.

#RandomSmileys.py

import random

import turtle

t = turtle.Pen()

t.speed(0)

t.hideturtle()

turtle.bgcolor("black")

def draw_smiley(x,y):

t.penup()

t.setpos(x,y)

t.pendown()

# Head

t.pencolor("yellow")

t.fillcolor("yellow")

t.begin_fill()

t.circle(50)

t.end_fill()

# Left eye

t.setpos(x-15, y+60)

t.fillcolor("blue")

t.begin_fill()

t.circle(10)

t.end_fill()

# Right eye

t.setpos(x+15, y+60)

t.begin_fill()

t.circle(10)

t.end_fill()

# Mouth

t.setpos(x-25, y+40)

t.pencolor("black")

t.width(10)

t.goto(x-10, y+20)

t.goto(x+10, y+20)

t.goto(x+25, y+40)

t.width(1)

for n in range(50):

x = random.randrange(-turtle.window_width()//2,

turtle.window_width()//2)

y = random.randrange(-turtle.window_height()//2,

turtle.window_height()//2)

draw_smiley(x,y)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!