続・えちごやん個人メモのブログ

えちごやん個人メモの移転先...。

learn python hard way. ex19

http://learnpythonthehardway.org/book/ex19.html

learn python hard way. ex19の課題。

後、他にも入力方法を変えるなどのやり方がある。

#!/usr/bin/env python
def wine_and_beer(wine_count, bottle_of_beer):
        print "We have %d wine!" % wine_count
        print "We have %d beer!" % bottle_of_beer
        print "Man that's enouh for a party!"
        print "Get a blanket. \n"
        
print "We can input varialbles: "
your_wine = input("I have no wine, how many bottles of wine do you have ?")
your_beer = input("I have no beer, how many bottles of beer do you have ?")
wine_and_beer(your_wine, your_beer)

print "We can combine the two varialbles and math: "
your_wine = input("I have two bottles of wine, how many bottles of wine do you have ?")
your_beer = input("I have three bottles of beer, how many bottles of beer do you have ?")
wine_and_beer(your_wine+2, your_beer+3)

自分で改変してみた。