importing assignment into modul re/expected string or buffer Python, -
well started learning python don't understand how make code correct (worth learn youtube))). want code -- if assignment num1 has 8 in end , should printed command print, , if doesn't print nothing.
import re def x(): num1 = 5894652138 vav = re.match(r'[8]''$', num1) print vav x()
you don't need use re here. check last digit in decimal number, should use modulos 10:
num1 = 5894652138 if num1 % 10 == 8: print num1
Comments
Post a Comment