_won_
wonprogrammer
_won_
전체 방문자
오늘
어제
  • 분류 전체보기
    • woncoding
      • TIL
      • WIL
    • source Code
      • Python
      • Programmers
      • BAEKJOON

블로그 메뉴

  • 방명록

티스토리

Github · Wonprogrammer
hELLO · Designed By 정상우.
_won_

wonprogrammer

source Code/BAEKJOON

BAE/<JOON> | 반복문

2022. 9. 5. 20:49

 

1. [case_sum_11021.py]

tc = int(input())

sum = 0

for case in range(1, tc+1) :
    a, b = map(int, input().split())
    sum = a+b
    print(f'Case #{case}: {sum}')

    print('Case #%d: %d' %(case,sum))

 

 

 

 

 

2. [list_10871.py]   : tc가 주어지면 tc만큼 list를 입력 해야되는데 적든/많든 상관없이 실행됨 (인터넷도 동일하게 설명되어 있음)

tc, num = map(int,input().split())

list_num = list(map(int,input().split()))

# list_num = []
small_num = []

# for case in range (1, tc+1) :
#     a = int(input())
#     list_num.append(a)


for i in list_num :
    if i < num :
        small_num.append(i)


print(*small_num,end=" ")



❌ 추후 수정 요망 ❌

 

 

 

 

 

3. [multifly_2739.py]

num = int(input())

multiply = 0

for i in range(1, 10) :
    multiply = num * i
    print(f'{num} * {i} = {multiply}')

 

 

 

 

 

4. [number_sum_1110.py]

n = int(input())

number = n

count = 0

while True :
    fst = number // 10
    snd = number % 10
    trd = (fst + snd) % 10

    number = (snd*10) + trd

    count += 1

    if n == number :
        break

print(count)

 

 

 

 

 

5. [receipt_25304]

x = int(input())

tc = int(input())

sum_price = 0

for i in range(1, tc+1) :
    price, count = map(int, input().split())
    sum_price = sum_price + (price * count)

if sum_price == x :
    print('Yes')
else :
    print('No')

 

 

 

 

 

6. [speed_sum.py] :  sys.stdin.readline().split()

import sys
tc = int(input())

sum = 0

for i in range(1, tc+1) :
    num_1, num_2 = sys.stdin.readline().split()
    
	❌ 추가 학습 요망 ❌

    num_1 = int(num_1)
    num_2 = int(num_2)

    sum = num_1 + num_2
    print(sum)

 

 

 

 

 

7. [star_blank_2439.py]

tc = int(input())

star = '*'
blank = ' '

for i in range (1, tc+1) :
    blanks = blank * (tc-i)
    stars = star * i
    print(f'{blanks}{stars}')

 

 

 

 

 

8. [try_sum_10951.py]

while True :
     try:
          a, b = map(int, input().split())
          if (a > 0) or (b > 0) :
               print(a+b)
     except :
          break

 

 

 

 

 

9. [while_sum_10952.py]

while True :
     a, b = map(int, input().split())
     if (a!=0) or (b!=0) :
          print(a+b)
     else:
          break

'source Code > BAEKJOON' 카테고리의 다른 글

BAE/<JOON> | 1차원 배열  (0) 2022.09.06
BAE/<JOON> | 조건문  (0) 2022.09.05
BAE/<JOON> | 입력과 사칙연산  (0) 2022.09.01
    'source Code/BAEKJOON' 카테고리의 다른 글
    • BAE/<JOON> | 1차원 배열
    • BAE/<JOON> | 조건문
    • BAE/<JOON> | 입력과 사칙연산
    _won_
    _won_
    Coding Practice blog

    티스토리툴바