Last digit !!!??

last_digits , string , algorithms

Get last digit from a string #

s1 = "Get 10% off on minimum cart value of $199"

def last_digit(s1):
	# (1)
	digits = [x for x in s1 if x.isdigit()]

	# (2)
	ld = digits[-1]

	# (3)
	print(ld)

last_digit(s1)

How it works #

Thanks for reading :) #