diff --git a/4-loops/20_99_bottles_2.py b/4-loops/20_99_bottles_2.py new file mode 100644 index 0000000..b30b92a --- /dev/null +++ b/4-loops/20_99_bottles_2.py @@ -0,0 +1,14 @@ +# 99 Bottles of Beer 🍻 +# Codédex + +for i in range(99, 0, -1): + if i > 1: + print(f'{i} bottles of beer on the wall') + print(f'{i} bottles of beer') + print(f'Take one down, pass it around') + print(f'{i-1} bottles of beer on the wall\n') + else: + print(f'{i} bottle of beer on the wall') + print(f'{i} bottle of beer') + print(f'Take one down, pass it around') + print(f'No more bottles of beer on the wall\n') diff --git a/README.md b/README.md index cb56759..569ea2e 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ Welcome to The Legend of Python GitHub repo! We are super excited to have you. H - [`enter_pin.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/17_enter_pin.py) - [`guess_number.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/18_guess_number.py) - [`detention.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/19_detention.py) -- [`99_bottles.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/20_99_bottles.py) +- [`99_bottles.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/20_99_bottles.py) (solution 1) +- [`99_bottles.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/20_99_bottles_2.py) (solution 2) - [`fizz_buzz.py`](https://github.com/codedex-io/python-101/blob/main/4-loops/21_fizz_buzz.py) ## Lists