python条件语句多条件_Python简介,第3章-条件语句

python条件语句多条件



Emerging from the sewer, Baldric found himself in the basin of a dry fountain. In its center was a marble statue of a massive fist which appeared to be composed of many entangled bodies. Employees, by how they were dressed. There were holes in various mouths and eyes that were apparently meant to be channeling water. “I’ve got a bad feeling about this,” Baldric muttered. Shaking off his fear along with the sewage, he climbed out of the fountain and proceeded across the polished granite floors of the otherwise empty, high-ceilinged room towards a particular pair of iron-reinforced doors. They were unlocked, and with a heave, he pulled one open and started down the dim rock-wall passage. It seemed to be sloping downward.

E会从下水道合并,佩饰发现自己在一个旱喷泉盆地。 在它的中心是一个大理石雕像,拳头巨大,似乎由许多纠缠的尸体组成。 员工,通过他们的衣着。 各种嘴巴和眼睛上都有Kong,显然是要引导水的。 “对此我有一种不好的感觉,”鲍德里克喃喃地说。 他摆脱了污水带来的恐惧,从喷泉中爬出,穿过原本空旷的高天花板房间的抛光花岗岩地板,朝着一对特殊的铁加固门前进。 他们被解锁了,他举起头来拉开一个,开始沿着暗淡的岩壁通道走。 它似乎向下倾斜。

1室 (Chamber 1)

After a time the passage opened up into a small, unadorned stone chamber, the first of six according to Cassandra. Two arched doorways leading out of the chamber stood in front of Baldric. Carved into the rock above the leftmost doorway was the expression 157 * 211. Above the other doorway was carved 37 * 919. On the ceiling of the chamber was the “greater than” symbol >.

过了一会儿,通道通向一个没有装饰的小石室,根据卡桑德拉的说法,这是六分之一。 从房间出来的两个拱形门口站在波德里克的面前。 157 * 211刻在最左侧门口上方的岩石上。 在另一个门口上方刻有37 * 919 。 在房间的天花板上是“大于”符号>

“Based on what Cassandra said, I need to take the doorway with the greater result. I’ll bet I can weave some magic to figure that out.”

“根据卡桑德拉所说的,我需要走出更好的结果。 我敢打赌,我可以编织一些魔术来解决这个问题。”

>>> 157 * 211 > 37 * 919
False

“So Door 1 is not greater than Door 2, which means that Door 2 is in fact the greater door, and so I should take Door 2. But what is this new thing I’ve produced? Is False a string?”

“因此,门1不大于门2,这意味着门2实际上是更大的门,因此我应该选择门2。但是,我生产的这件新东西是什么? 是字符串吗?”

“That’s right, comparisons become booleans, which can take the form of either True or False. Interesting. Anyways, these comparisons are supposed to get more difficult, and Cassandra mentioned that death and worse lurks in the incorrect passages, so I’d better see if I can weave Magic that’s a little easier to read and understand.”

“That’s right, comparisons become booleans, which can take the form of either True or False . Interesting. Anyways, these comparisons are supposed to get more difficult, and Cassandra mentioned that death and worse lurks in the incorrect passages, so I’d better see if I can weave Magic that’s a little easier to read and understand.”

>>> door1 = 157 * 211
>>> door2 = 37 * 919
>>> door1 > door2
False

“That’s more readable, but I wish I could have it just tell me which door to go down so I don’t even have to think about it…oh yeah, I forgot! That Book of Magic had a section on conditional statements.”

“That’s more readable, but I wish I could have it just tell me which door to go down so I don’t even have to think about it…oh yeah, I forgot! That Book of Magic had a section on conditional statements.”

# notice the code's structure here, how it is indented
# try using a single tab (equivalent in length to 4 spaces) as your standard indentation

if 1 > 2:
    print("It's True!")
else:
    print("It's False!")
It's False!

“I remember now, conditional statements use booleans to determine which branch of code gets executed. 1 is not greater than 2, so that first if branch’s condition is False. Therefore, the else branch gets executed. Let’s see if I can get them to work in the case of this little puzzle…”

“I remember now, conditional statements use booleans to determine which branch of code gets executed. 1 is not greater than 2, so that first if branch’s condition is False . Therefore, the else branch gets executed. Let’s see if I can get them to work in the case of this little puzzle…”

# note that the code is now written in 'script mode'
# and the result of the code is shown in a separate window

door1 = 157 * 211
door2 = 37 * 919

if door1 > door2:
    print('Proceed through Door 1')
else:
    print('Proceed through Door 2')
Proceed through Door 2

“There we go, much harder to mix up.” Baldric happily strolled through Door 2 and once again proceeded down a dimly-lit passage before arriving at a second chamber.

“There we go, much harder to mix up.” Baldric happily strolled through Door 2 and once again proceeded down a dimly-lit passage before arriving at a second chamber.

Chamber 2(Chamber 2)

In this chamber were a total of three arched doorways.

In this chamber were a total of three arched doorways.

  • Above Doorway 1:     661 * 691
  • Above Doorway 2:     61 *
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值