资源简介 逻辑运算 湖北教育出版社九年级上册《信息技术》 让程序改变世界!Change the world by program! 石 头 剪 刀 布 逻 辑 关 系 图 让程序改变世界!Change the world by program! 胜 胜 胜 学 一 学 试 一 试 让程序改变世界!Change the world by program! 真(True) 假(False) 与运算(and) 或运算(or) 非运算(not) 试 一 试 False True × √ 让程序改变世界!Change the world by program! 1、在Python中输入1<2,运行结果是: 试 一 试 True False × √ 让程序改变世界!Change the world by program! 2、在Python中>>>s1=True >>>s2=False >>>print (s1 and s2) 运行结果是: 让程序改变世界!Change the world by program! 试 一 试 False True × √ 3、在Python中>>>s1=True >>>s2=False >>>print (s1 or s2) 运行结果是: 试 一 试 False True × √ 让程序改变世界!Change the world by program! 4、在Python中>>>s1=True >>>s2=False >>>print (not s2) 运行结果是: Guido van Rossum 吉多·范罗苏姆 让程序改变世界!Change the world by program! 让程序改变世界!Change the world by program! 做 一 做 1、在“石头剪刀布”游戏中,用逻辑运算得输赢结果。完成10.2 “石头剪刀布”手势表达式 电脑的“手势” 表示的数 我的“手势” 表示的数 赢 家 表达式 1 3 我胜 电脑==1 and 人==3 2 让程序改变世界!Change the world by program! 石 头 剪 刀 布 游 戏 程 序 代 码 练 一 练 1、在编写程序时,会遇到各种逻辑运算,先说出下面各表达式的运算结果,再上机验证。 表达式 not False, not 0, not 5, True and(1 or 4), True and (1<4) 运算结果 表 达 式 True and ((not 1) or (1<4)) or ((4>5) and (2>3)) 运算结果 True True False 1 True True 练 一 练 2、试着把“我胜”的条件合在一起,并完成程序。 (computer==1 and man==3)or (computer==2 and man==1) or (computer==3 and man==2) 让程序改变世界!Change the world by program! 我胜 说 一 说 谈 一 谈 评 一 评 让程序改变世界!Change the world by program! 说 一 说 谈 一 谈 评 一 评 让程序改变世界!Change the world by program! THANKS 展开更多...... 收起↑ 资源预览