-코드
n = int(input())
for i in range(n, -1, -1):
if i == 0:
print('No more bottles of beer on the wall, no more bottles of beer.')
if n == 1:
print('Go to the store and buy some more, 1 bottle of beer on the wall.')
elif n == 0:
print('Go to the store and buy some more, no more bottles of beer on the wall.')
else:
print(f'Go to the store and buy some more, {n} bottles of beer on the wall.')
elif i == 1:
print('1 bottle of beer on the wall, 1 bottle of beer.')
print('Take one down and pass it around, no more bottles of beer on the wall.')
else:
print(f'{i} bottles of beer on the wall, {i} bottles of beer.')
if i == 2:
print(f'Take one down and pass it around, {i - 1} bottle of beer on the wall.')
else:
print(f'Take one down and pass it around, {i - 1} bottles of beer on the wall.')
print()
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 2553번 마지막 팩토리얼 수 (0) | 2021.12.06 |
---|---|
[백준/파이썬] 15988번 1, 2, 3 더하기 3 (0) | 2021.12.06 |
[프로그래머스/파이썬] 약수의 합 (0) | 2021.12.06 |
[백준/파이썬] 1622번 공통 순열 (0) | 2021.12.06 |
[프로그래머스/파이썬] 숫자 문자열과 영단어 (0) | 2021.12.05 |