fork download
  1. p,q=map(int,input().split())
  2. arr=[]
  3. for i in range(p):
  4. arr.append(list(map,input().split()))
  5. #사전식 정렬->내가 a,c,g,t순서대로 else if 문을 짜면 그만이다!
  6. def max(a,b,c,d):
  7. if a>=b and a>=c and a>=d:
  8. return a
  9. elif b>a and b>=c and b>=d:
  10. return b
  11. elif c>a and c>b and c>=d:
  12. return c
  13. else:
  14. return d
  15.  
  16. L=[None]*p
  17. hd=0
  18. for j in range(q):
  19. a,c,g,t=0,0,0,0
  20. for i in range(p):
  21. if arr[i][j]=='A':#숫자가 아니어서 'A'떠옴표 해줘야돼!
  22. a+=1
  23. if arr[i][j]=='C':
  24. c+=1
  25. if arr[i][j]=='G':
  26. g+=1
  27. if arr[i][j]=='T':
  28. t+=1
  29. if max(a,c,g,t)==a:
  30. L[j]=='A'
  31. hd+=p-a
  32. elif max(a,c,g,t)==c:
  33. L[j]=='C'
  34. hd+=p-c
  35. elif max(a,c,g,t)==g:
  36. L[j]=='G'
  37. hd+=p-g
  38. else:
  39. L[j]==t
  40. hd+=p-t
  41. print(L,hd)
  42.  
Runtime error #stdin #stdout #stderr 0.2s 26216KB
stdin
5 8
TATGATAC
TAAGCTAC
AAAGATCC
TGAGATAC
TAAGATGT
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 4, in <module>
TypeError: list expected at most 1 argument, got 2