How to use switch-case(or match-case) in python || #PythonProjects 10 || #codeinmobile #python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

This is not a switch case ! switch case is not supported in Python.

ashishchakrabarty
Автор

FYI this is not what match statements are for.

PhantomfireWasHere
Автор

monday={10:"Data Science", 11:"Morning Break", 1115:"Data Structure", 12:"Oops", 1245:"Lunch Break", 130:"Maths", 215:"Dpco", 3:"Evening Break", 315:"Data Structure Lab", 430:"College Over"}

hour_input=input("Enter the hour:")

print(f"Enter the minute {hour_input} : ", end="")
minute_input=input()

conc=int(hour_input + minute_input)
if conc<10:
print("college was not started yet")
elif conc>=1000 and conc<=1100:
print(monday[10])
elif conc>1100 and conc<=1115:
print(monday[11])
elif conc>1115 and conc<=1200:
print(monday[1115])
elif conc>1200 and conc<=1245:
print(monday[12])
elif conc>1245 and conc<=130:
print(monda[1245])
elif conc>130 and conc<=215:
print(monday[130])
elif conc>215 and conc<=300:
print(monday[215])
elif conc>300 and conc<=315:
print(monday[3])
elif conc>315 and conc<=430:
print(monday[315])
else:
print(monday[430])

nothing