-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path99bottles.py
More file actions
27 lines (18 loc) · 791 Bytes
/
99bottles.py
File metadata and controls
27 lines (18 loc) · 791 Bytes
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
Q) The song "99 Bottles of Beer" starts with this verse:
99 bottles of beer on the wall
99 bottles of beer
Take one down, pass it around
98 bottles of beer on the wall
Then the second verse is the same, except that it starts with 98 bottles and ends with 97. The song continues -- for a very long time -- until there are 0 bottles of beer.
Write a function called bottle_verse that takes a number as a parameter and displays the verse that starts with the given number of bottles.
SOLUTIONS:
def verse(num):
print(f"{num} bottles of beer on the wall\n99 bottles of beer")
def verse2():
print("Take one down, pass it around")
def bottle_verse(num):
verse(num)
verse2()
while num >=0:
num = num -1
print(f"{num} bottles of beer on the wall")