python习题19

 1 def cheese_and_crackers(cheese_count, boxes_of_crackers):
 2     print(f"You have {cheese_count} cheese!")
 3     print(f"You have {boxes_of_crackers} boxes fo crackers!")
 4     print("Man that's enough for a party!")
 5     print("Get a blanknet.\n")
 6     
 7     
 8 print("We can just give the function numbers directly:")
 9 cheese_and_crackers(20,30)
10 
11 
12 print("OR, we can use variables from our script:")
13 amount_of_cheeses = 10
14 amount_of_crackers = 50
15 
16 cheese_and_crackers(amount_of_cheeses, amount_of_crackers)
17 
18 
19 print("We can even do math inside too:")
20 cheese_and_crackers(10 + 20, 5 + 6)
21 
22 print("And we can combine the two, variables and math:")
23 cheese_and_crackers(amount_of_cheeses + 100, amount_of_crackers + 1000)
 1 def book_123(book_page, book_jiage,book_zishu):
 2     print(f"这本书一共有 {book_page}页,约{book_zishu}万字。")
 3     print(f"这本书的价格是{book_jiage}元。")
 4 
 5 
 6 print("001:我刚刚买了一本书。")
 7 book_123(50,20,10)
 8 
 9 print("002:我换一种方式说。")
10 page = 50
11 zishu = 20
12 jiage = 10
13 
14 book_123(page, zishu, jiage)
15 
16 print("003:我换一本五倍的书试试。")
17 book_123(page * 5, zishu * 5, 50)
18 
19 print("004:继续。")
20 book_page = int(input(">>>>"))
21 book_jiage = int(input(">>>>"))
22 book_zishu = int(input(">>>>"))
23 
24 book_123(book_page + 1, book_jiage + 1,book_zishu + 1)

 

转载于:https://www.cnblogs.com/shadowyuriya/p/10061380.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值