An artificial synapse is essential for neuromorphic computing which has been expected to overcome the bottleneck of the traditional von-Neumann system. Memristors can work as an artificial synapse owing to their tunable non-volatile resistance states which offer the capabilities of information storage, processing, and computing. In this work, memristors based on two-dimensional (2D) MXene Ti3C2 nanosheets sandwiched by Pt electrodes are investigated in terms of resistive switching (RS) characteristics, synaptic functions, and neuromorphic computing. Digital and analog RS behaviors are found to coexist depending on the magnitude of operation voltage. Digital RS behaviors with two resistance states possessing a large switching ratio exceeding 103 can be achieved under a high operation voltage. Analog RS behaviors with a series of resistance states exhibiting a gradual change can be observed at a relatively low operation voltage. Furthermore, artificial synapses can be implemented based on the memristors with the basic synaptic functions, such as long-term plasticity of long-term potentiation and depression and short-term plasticity of the paired-pulse facilitation and depression. Moreover, the "learning-forgetting" experience is successfully emulated based on the artificial synapses. Also, more importantly, the artificial synapses can construct an artificial neural network to implement image recognition. The coexistence of digital and analog RS behaviors in the 2D Ti3C2 nanosheets suggests the potential applications in non-volatile memory and neuromorphic computing, which is expected to facilitate simplifying the manufacturing complexity for complex neutral systems where analog and digital switching is essential for information storage and processing.