Guest User

Code for 420

a guest
Apr 25th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. index = 0
  2. for i in range(5000000):
  3.     if index == 5000:
  4.         break
  5.     t = str(i + 1)
  6.     str_check = ''
  7.     for j in range(len(t)):
  8.         if str_check == '':
  9.             if t[j] =='4':
  10.                 str_check = '4'
  11.                 continue
  12.             else:
  13.                 str_check = ''
  14.         elif str_check == '4':
  15.             if t[j]=='2':
  16.                 str_check = '42'
  17.                 continue
  18.             elif t[j] == '4':
  19.                 str_check = '4'
  20.             else:
  21.                 str_check = ''
  22.         elif str_check == '42':
  23.             if t[j] =='0':
  24.                 str_check = ''
  25.                 print t
  26.                 index += 1
  27.                 break
  28.             elif t[j] == '4':
  29.                 str_check = '4'
  30.             else:
  31.                 str_check = ''
Add Comment
Please, Sign In to add comment