Riju21

21_prac6_

Mar 29th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1.  
  2. # def squ(x):
  3. #     for i in range(1,x+1):
  4. #         calc = 1 + (2*(i - 1))
  5. #         print('*' * calc)
  6.  
  7. # squ(4)
  8.  
  9. # magic or normal
  10.  
  11. number = ['100110100011100001', '10110', '11001001', '1001','1']
  12.  
  13. def check_magic(i):
  14.     inList = list(i)
  15.     onecount = inList.count('1')
  16.     zerocount = inList.count('0')
  17.  
  18.     if onecount > zerocount:
  19.         print('normal')
  20.     elif onecount == zerocount or onecount < zerocount:
  21.         print('magic')
  22.  
  23. for i in number:
  24.     check_magic(i)
Advertisement
Add Comment
Please, Sign In to add comment