Advertisement
sparrowekk

Untitled

Mar 25th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. def isLucky(n):
  2.    
  3.  
  4.  
  5.   e_list = []
  6.   ss_list = []
  7.  
  8.   for i in str(n):
  9.     i = str(i)
  10.     e_list.append(i)
  11.    
  12.    
  13.   for i in e_list:
  14.     i = int(i)
  15.     ss_list.append(i)  
  16.    
  17.  
  18.   first_half = [ss_list[y] for y in range(0, len(ss_list)//2)]
  19.   second_half = [ss_list[x] for x in range(len(first_half), len(ss_list))]
  20.  
  21.  
  22.  
  23.   if sum(first_half) == sum(second_half):
  24.     return True
  25.   else:
  26.     return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement