본문 바로가기

Algorithm/SWEA

[SWEA / python] 1545. 거꾸로 출력해 보아요

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV2gbY0qAAQBBAS0&categoryId=AV2gbY0qAAQBBAS0&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=PYTHON&select-1=1&pageSize=10&pageIndex=2 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

T = int(input())

while T > 0:
    print(str(T),end=" ")
    T=T-1
print("0")

 

for문 3번째 인자에 -1 작성하는 방법도 있음

for i in range(T,-1,-1):
	print(i, end=" ")