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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -