代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
__author__ = 'Liu'
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 enough for party")
print("Get a blanket.\n")
# 可以直接给函数传数字
print("We can just give the function numbers directly:")
cheese_and_crackers(20, 30)
# 还能通过input让用户输入数量再输出
cheese_and_crackers(int(input("cheese>")), int(input("crackers>")))
print("Or we can use variable from our script:")
amount_of_cheeses = 10
amount_of_crackers = 50
# 也可以直接给函数传变量
cheese_and_crackers(amount_of_cheeses, 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_cheeses + 100, amount_of_crackers + 1000)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。