01-10807-개수세기
입력받아서 리스트 변수로 넣기 리스트 항목 개수 세기
N = int(input())
ARRAY = list(map(int, input().split()))
NUMBER = int(input())
print(ARRAY.count(NUMBER))
02-10871-X보다 작은 수
리스트에서 조건에 맞는 항목만 출력하기
N, X = map(int, input().split())
ARRAY = list(map(int, input().split()))
LIST = list()
for i in ARRAY:
if i < X and i not in LIST:
print(i, end=' ')
03-10818-최소,최대
리스트 자료 중 최대 최소값
N = int(input())
LIST = list(map(int, input().split()))
print(min(LIST), max(LIST))
04-2562-최댓값
최대값이 몇번째 숫자인지
LIST = []
for i in range(9):
LIST.append(int(input()))
print(max(LIST))
print(LIST.index(max(LIST))+1)
05-5597-과제 안 내신분
리스트에서 자료 삭제
LIST = list(range(1, 31))
for i in range(28):
LIST.remove(int(input()))
print(min(LIST))
print(max(LIST))
06-3052-나머지
입력받은 수 리스트에 추가하기
LIST = []
SORT = []
for i in range(10):
LIST.append(int(input()) % 42)
for j in LIST:
if j not in SORT:
SORT.append(j)
print(len(SORT))
07-1546-평균
N = int(input())
SORT = []
TOTAL = 0
LIST = list(map(int, input().split()))
for j in LIST:
SORT.append(j/max(LIST)*100)
for k in SORT:
TOTAL = TOTAL + k
print(TOTAL / N)
08-8958-OX퀴즈
N = int(input())
NUM = 0
SUB_TOTAL = 0
TOTAL = 0
for j in range(N):
RESULTS = list(input())
RESULTS.append('X')
while 'O' in RESULTS:
for i in RESULTS:
if i == 'O':
NUM += 1
SUB_TOTAL += NUM
RESULTS[RESULTS.index(i)] = 'X'
else:
TOTAL += SUB_TOTAL
NUM = 0
SUB_TOTAL = 0
continue
print(TOTAL)
TOTAL = 0
09-4344-평균은 넘겠지
for i in range(int(input())):
TEST = list(map(int, input().split()))
OVER_AVER_NUM = 0
SUM = 0
for i in (range(TEST[0])):
SUM += TEST[i+1]
AVER = SUM / TEST[0]
for i in (range(TEST[0])):
if TEST[i+1] > AVER:
OVER_AVER_NUM += 1
RATIO = format(float(OVER_AVER_NUM/TEST[0] * 100), ".3f")
print(f"{RATIO}%")
0 댓글