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~