自学Python笔记 Day 10: Lesson 27~ Lesson29

Day 10

Lesson 27

开始学“逻辑”了 有一些要背的东西了… 之前学过编程其他语言的人应该可以跳过 因为这个都是通用的~
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Lesson 28

这道题我建议大家copy完代码自己先算一遍~

True and True
False and False
1 == 1 and 2 == 2
"test" == 'test'
1 == 1 or 2 != 1
True and 1 == 1
False and 0 != 0
True or 1 == 1
"test" == "testing"
1 != 0 and 2 == 1
"test" != "testing"
"test" == 1
not (True and False)
not (1 == 1 and 0 != 1)
not (10 == 1 or 1000 == 1000)
not (1 != 10 or 3 == 4)
not ("testing" == "testing" and "Zed" == "Cool Guy")
1 == 1 and (not ("testing" == 1 or 1 == 0))
"chunky" == "bacon" and (not (3 == 4 or 3 == 3))
3 == 3 and (not ("testing" == "testing" or "Python" == "Fun"))

下图是在Pycharm Terminal中的运行样子
在这里插入图片描述

当然 终端也行
在这里插入图片描述

Lesson 29

if 语句:

ice_cream_ball = 10
corn = 15
paper = 20
whole_ice_cream = ice_cream_ball + corn

if ice_cream_ball > corn:
    print ("We need more corn!")

if corn > ice_cream_ball:
    print ("Oh no! There's not enough ice cream ball!")

if paper < whole_ice_cream:
    print ("Quick! More people need paper!")

if paper > whole_ice_cream:
    print ("We have some more paper, anyone need them?")

paper += 20

if paper >= whole_ice_cream:
    print ("There are more paper than whole ice cream, or they are equal")

if paper <= whole_ice_cream:
    print ("There are less paper than whole ice cream, or they are equal")

if paper == whole_ice_cream:
    print ("Paper and ice cream are equal")

好啦 今天就这三课
Au revoir~

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值