티스토리 뷰

 

1330번. 두 수 비교하기

 

 

▼해설보기

더보기

 

a, b = map(int, input().split())

if a>b:
    print('>')
elif a<b:
    print('<')
else:
    print('==')

 

def 는 사용자 정의 함수를 만들기 위해서 사용

만약 limit안에 들어간 숫자가 10000보다 크거나 -10000보다 작을 경우, 해당 변수에 값을 다시 받도록 코드 작성

 

9498번. 시험 성적

 

▼해설보기

더보기

방법 1

score = int(input())

if score == 100 or score >= 90 :
  print('A')
elif score >= 80 and score < 90 :
  print('B')
elif score >= 70 and score < 80 :      
  print('C')
elif score >= 60 and score < 70 : 
  print('D')  
else :
  print('F')

 

방법 2

score = int(input())

if score >= 90 :
  print('A')
elif 80 <= score < 90 :
  print('B')
elif 70 <= score < 80 :      
  print('C')
elif 60 <= score < 70 : 
  print('D')  
else :
  print('F')

 

2753번. 윤년

 

▼해설보기

더보기

 

year = int(input())

if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0 ) :
 print('1')
else :
 print('0')

 

14681번. 사분면 고르기

 

 

▼해설보기

더보기
x = int (input())
y = int (input())

if (x>0 and y>0):
    print('1')
elif (x>0 and y<0):
    print('4')
elif (x<0 and y>0):
    print('2')
elif( x< 0 and y<0):
    print('3')

 

'Computer Science > 백준 (Python)' 카테고리의 다른 글

[6단계] 문자열  (0) 2022.06.12
[5단계] 함수  (0) 2022.06.12
[4단계] 1차원 배열  (0) 2022.06.07
[3단계] 반복문  (0) 2022.06.06
[1단계] 입출력과 사칙연산  (0) 2022.05.31
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/05   »
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
글 보관함