Jun-05-2022, 10:27 AM
(This post was last modified: Jun-05-2022, 10:50 AM by Yoriz.
Edit Reason: Added code tags
)
Hi guys, I have a question. I'm currently working my way through the Headfirst Python book. And there is an exercise where you create an app based around the song 99 bottles of beer. I'll paste the code here in a moment.
I just deleted beer and replaced it with a different word, and it works in the same way
So I guess that it is
word = "bottles" for beer_num in range(99, 0, -1): print(beer_num, word, "of beer on the wall.") print(beer_num, word, "of beer.") print("Take one down.") print("Pass it around.") if beer_num ==1: print("No more bottles of beer on the wall.") else: new_num = beer_num - 1 if new_num == 1: word = "bottle" print(new_num, word, "of beer on the wall.") print()My question is regarding beer_num, is this what you write when you want Python to determine how many times a word appears?
I just deleted beer and replaced it with a different word, and it works in the same way
So I guess that it is