# Example: SN1 vs SN2 reaction analysis
def reaction_type(substrate, nucleophile, solvent):
"""
Determine likely mechanism.
"""
# SN2: Primary alkyl halide, strong nucleophile, polar aprotic
if substrate in ['methyl', 'primary'] and nucleophile == 'strong':
return 'SN2'
# SN1: Tertiary alkyl halide, weak nucleophile, polar protic
elif substrate == 'tertiary' and nucleophile == 'weak':
return 'SN1'
# E2: Strong base, anti-periplanar H
elif nucleophile == 'strong_base':
return 'E2'
return 'mixture'