Essential Question: How can I use the mod function to recreate a program that finds a user's Asian Zodiac animal?
Mastery Objectives:
SWBAT use the mod function in python.
SWBAT upload images in python.
SWBAT create a complicated conditional statement.
Do Now: Look at these formulas and see if you can figure out what mod does?
20 mod 5 = 0
20 mod 3 = 2
12 mod 5 = 2
30 mod 3 = 0
30 mod 7 = 2
Do Now 2:
Write a program that tells the user whether a number is odd or even:
num = int(input("Enter a number: "))
mod = num % 2
if mod > 0:
print("This is an odd number.")
else:
print("This is an even number.")
Animal Descriptions: https://www.chinahighlights.com/travelguide/chinese-zodiac/
Directions: Create a program that allows the user to enter a year and tells the user the Asian Zodiac animal that corresponds with it. The second part of the project requires the user to show a picture of the animal.
Inserting Images
In order to import images, you need to upload the image.
Click on this icon and you will see the section where images are uploaded.
Your screen should look like this.
Click on + Image Library to add your images
Your screen should look like this.
Click on "Upload New Image"
Your screen should look like this.
Click on "Click to Select Images"
Browse for the image file you want to upload.
When the image is uploaded, you will see it in the window.
Click on the done button.
When you are finished uploading all of your images, click on "main.py" to return to your code.
You need to import the turtle library
Create a screen variable and set it to the Screen() function from the turtle library
Create a variable,
To turn your image so that it faces the correct direction, add the following code: rat.setheading(90)
This makes the image face 90 degrees.