1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1) 문자열 입력 받은 후 공백 기준 파싱 2) 숫자 엔터 구분 3) 문자 엔터구분 4) 문자열 엔터구분 5) N by N 6) N by M 1) 공백 구분 입력 받기 N = list(map(str input().strip().split())) 2) 숫자 엔터구분 입력받기 cnt = int(input()) strs = "" lists = [] for i in range(cnt): N = int(input()) strs.append(N) lists.append(N) print(lists) 3) 4) 문자 문자열 엔터구분 cnt = int(input()) strs = "" lists = [] for i in range(cnt): N = input() strs.append(N) lists.append(N) print(strs) print(lists) 5) N by N N = 5 lists = [] for i in range(N): n = [] for j in range(N): n.append(int(input())) lists.append(n) print(lists) 6) N by M N = 5 M = 4 lists = [] for i in range(N): n = [] for j in range(M): n.append(int(input())) lists.append(n) print(lists) | cs |
'Programming Language > Python' 카테고리의 다른 글
파이썬 10진수 n진수로 변환 (0) | 2019.10.12 |
---|---|
Python 순열(Permutation) (0) | 2019.10.09 |
Python itertools를 이용한 순열과 조합 (combinations, permutations) (0) | 2019.10.09 |
Python String copy (0) | 2019.10.09 |
Python Dictionary Max, Min Key, Value(파이썬 딕셔너리, 사전 최대 최소 구하기) (0) | 2019.10.05 |