# -*- coding: utf-8 -*-
# @Author: yt
# @Date: 2018-05-15 13:46:02
# @Last Modified by: yt
# @Last Modified time: 2018-05-15 14:44:24
def cheese_and_crackers(cheese_count,boxes_of_crackers):
print "You have %d cheeses!"% cheese_count
print "You have %d boxes of crackers!"%boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket.\n"
print "We can just give the function numbers directly:"
cheese_and_crackers(20,30)
print "OR,we can use variables from our script:"
amount_of_cheese =10
amount_of_crackers = 50
cheese_and_crackers(amount_of_cheese, amount_of_crackers)
print "We can even do math inside too:"
cheese_and_crackers(10+20, 5+6)
print "And we can combine the two, variables and math:"
cheese_and_crackers (amount_of_cheese+100, amount_of_crackers+1000)
运行结果如下:函数和变量ex19.py
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 解析: 全局变量(外部变量)的说明之前再冠以static就构成了静态的全局变量。 全局变量本身就是静态存贮方式,静...
- Js总的采取词法作用域,也就是静态作用域。词法作用域是作用域在词法分析阶段就确定了,不会改变,即变量的作用域是在定...
- #!/usr/bin/python # # Licensed to the Software Freedom Co...