repl.it
@xfy/

Hour of Code 2019

Python

No description

fork
loading
Files
  • main.py
  • answerkey.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Welcome to hour of code - Status edition!
# For Portola High School

# Advanced version!
# Using Google is NOT cheating. In fact, it is **highly** encouraged.
# If you don't know python, see the other tutorial.

# Step 0: DON'T EDIT
import datetime

# Step 1, Get the Schedule Data
# I just did this step for you.
schedule = [
  {"end":"09:24", "name":"Period 2", "period":2, "start":"08:00"},{"end":"10:03", "name":"Office Hours", "period":None,"start":"09:24"},{"end":"10:14", "name":"Break", "period":None,"start":"10:03"},{"end":"11:44", "name":"Period 4", "period":4,"start":"10:20"},{"end":"12:19", "name":"Lunch", "period":None,"start":"11:44"},{"end":"13:49", "name":"Period 6", "period":6,"start":"12:25"},{"end":"14:00", "name":"Break", "period":None,"start":"13:49"},{"end":"20:30", "name":"Period 8" ,"period":8,"start":"14:06"}
]

# Step 2, Get the current time...
# Hint: https://docs.python.org/3/library/datetime.html
# Hint #2: Use 24 hour time.
current_hour = None # Ex: 12
current_minute = None # Ex: 34

# Step 3, Figure out what time block is currently happening.
# You can assume there is a time block currently happening.
# Hint: You might want to use a for loop.
current_period = None # Ex: 1 is Office Hours in the example

# Step 4, Figure out how much time until it ends.
end_time = None # Ex: 5, for 5 minutes

# Step 5
# Check your work!
print(schedule[current_period].name + " ends in " + end_time + " minutes.")

# And that's it!