Section 238(2) in The Code of Criminal Procedure, 1989 (1933 A. D.)
(2)When a person is charged with an offence, and facts are proved which reduce it to a minor offence, he may be convicted of the minor offence although he is not charged with it.(2-a) When a person is charged with an offence, he may be convicted of an attempt to commit such offence although the attempt is not separately charged.