我对Python中的这段代码有问题。我需要把时间改成军事时间吗,怎么改?我的代码没有返回正确答案
问题是: 小时=3 分钟=45
#Around Georgia Tech, there are plenty of places to get a
#late night bite to eat. However, they have different hours,
#so when choosing where to go, you have to think about who's
#still open!
#
#Imagine you're choosing between the following restaurants:
#
# - Barrelhouse: Closes at 11:00PM
# - Taco Bell: Closes at 2:00AM
# - Cookout: Closes at 3:00AM
# - Waffle House: Never closes. Ever.
#
#Assume that this list is also a priority list: if Barrelhouse
#is open, you choose Barrelhouse. If not, you choose Taco Bell
#if it's open. If not, you choose Cookout if it's open. If
#not, you choose Waffle House.
#
#However, there are two wrinkles:
#
# - We're using 12-hour time.
# - hour will always represent a time from 10PM to 5AM.
#
#That means that if hour is 10 or 11, it's PM; if hour is
#12, 1, 2, 3, 4, or 5, it's AM. This will make your reasoning
#a little more complex. You may assume that all four
#restaurants open later than 6AM, though, so you don't have
#to worry about opening time, just closing time.
#
#Add some code below that will print what restaurant you'll
#go to based on the current values of hour and minute.
我的代码在这里
#Add your code here!
if hour == 12 and hour <= 5 and hour >= 1:
print("Taco Bell" , "Cookout", "Waffle House")
elif hour > 5 and hour < 11:
print("Waffle House" , "Barrelhouse")
您应该具有以下流程才能获得餐厅列表
相关问题 更多 >
编程相关推荐