I am writing a Python program but ended up having a bunch of if statements. Is there a way to shorten the code? Thanks in advance.
if val == M and time == p1:
    goto(0)
    sleep(1)
elif val == M and time == p2:
    goto(1)
    sleep(1)
elif val == M and time == p3:
    goto(2)
    sleep(1)
elif val == M and time == p4:
    goto(3)
    sleep(1)
elif val == M and time == p5:
    goto(4)
    sleep(1)
elif val == T and time == p1:
    goto(5)
    sleep(1)
elif val == T and time == p2:
    goto(6)
    sleep(1)
elif val == T and time == p3:
    goto(7)
    sleep(1)
elif val == T and time == p4:
    goto(8)
    sleep(1)
elif val == T and time == p5:
    goto(9)
    sleep(1)
 
     
     
    