나를 기록하다
article thumbnail
[백준 2753 파이썬/python] 윤년
Algorithm/baekjoon 2023. 2. 28. 16:20

1) 첫 번째 코드 year = int(input()) if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0): print(1) else: print(0) 2) 두 번째 코드 year = int(input()) print('1') if ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0) else print('0') 3) 결과 // 결과 // 입력값 2000 // 출력값 1 // 입력값 1999 // 출력값 0

article thumbnail
[백준 9498 파이썬/python] 시험 성적
Algorithm/baekjoon 2023. 2. 28. 16:11

score = int(input()) if score >= 90: print('A') elif score >= 80: print('B') elif score >= 70: print('C') elif score >= 60: print('D') else: print('F') // 결과 100 A 82 B 32 F

article thumbnail
[백준 1330 파이썬/python] 두 수 비교하기
Algorithm/baekjoon 2023. 2. 27. 19:36

A, B = map(int, input().split()) if A > B: print(">") elif A < B: print("

article thumbnail
[백준 10172 파이썬/python] 개
Algorithm/baekjoon 2023. 2. 27. 19:34

1) [오답] 내가 작성한 코드 print("|\\\\_/|") print("|q p| /}") print("( 0 )\\"\\"\\"\\\\") print("|\\"^\\"' |") print("||_/=\\\\\\\\__|") |\\_/| |q p| /} ( 0 )"""\\ |"^"' | ||_/=\\\\__| 2) [정답] 정답 코드 print("|\\_/|") print("|q p| /}") print('( 0 )"""\\\\') # \\'앞에 \\을 붙여준다. print('|"^"` |') print("||_/=\\\\\\__|") # \\\\ 앞에 \\을 하나 더 붙여준다. |\\_/| |q p| /} ( 0 )"""\\ |"^"` | ||_/=\\\\__| → 틀린 이유 ` 특수기호를 이용해..

article thumbnail
[백준 10171 파이썬/python] 고양이
Algorithm/baekjoon 2023. 2. 27. 19:32

print("\\\\ /\\\\") print(" ) ( ')") print("( / )") print(" \\\\(__)|") // 결과 \\ /\\ ) ( ') ( / ) \\(__)|

article thumbnail
[백준 2588 파이썬/python] 곱셈
Algorithm/baekjoon 2023. 2. 27. 15:11

A = int(input()) # 첫번째 입력받은 문자 : 숫자로 변환 B = input() # 두번째 입력받은 문자 : 문자열 그대로 둠 # 문자열의 인덱스를 이용해서 두번째 입력 받은 문자를 하나씩 숫자로 반환하고 A와 곱한다. AxB2 = A * int(B[2]) AxB1 = A * int(B[1]) AxB0 = A * int(B[0]) AxB = A * int(B) print(AxB2, AxB1, AxB0, AxB, sep='\\n') # sep='\\n'로 줄바꿈

profile on loading

Loading...