Algorithms (1.1) Homework Hacks

Hack 1

Chosen algorithm: Making a pizza from scratch

  1. Go to the store
  2. Get tomato sauce, cheese, and pizza bread
  3. Go back to the place where the pizza will be made
  4. Get supplies ready
  5. Put sauce on pizza bread
  6. Spread the sauce so it covers the entire pizza
  7. Put cheese on top of sauce so that it covers the entire pizza
  8. Place pizza on a tray
  9. Warm the oven to 450°F
  10. Put tray with pizza in the oven for 15 minutes
  11. Take pizza out
  12. Cut pizza in half horizontally
  13. Cut pizza in half vertically
  14. Cut pizza diagonally from the left
  15. Cut pizza diagonally from the right

Hack 2

Fixed algorithm:

  1. Open email application
  2. Log into your account
  3. Enter recipient's email address
  4. Write subject line
  5. Type the message
  6. Click send

Hack 3

print("Enter score 1: ")
scoreOne = int(input())

print("Enter score 2: ")
scoreTwo = int(input())

print("Enter score 3: ")
scoreThree = int(input())

averageScore = (scoreOne + scoreTwo + scoreThree) / 3

if averageScore >= 90:
    print("Grade is A")
elif averageScore >= 80:
    print("Grade is B")
elif averageScore >= 70:
    print("Grade is C")
elif averageScore >=60:
    print("Grade is D")
else:
    print("Grade is F")
Enter score 1: 
Enter score 2: 
Enter score 3: 
Grade is F