Advertisement

Python学习Conditionals & Control Flow

阅读量:

前言:

控制流程 具备对数据输出进行筛选的能力

例如:

复制代码
 def clinic():

    
     print "You've just entered the clinic!"
    
     print "Do you take the door on the left or the right?"
    
     answer = raw_input("Type left or right and hit 'Enter'.").lower()
    
     if answer == "left" or answer == "l":
    
     print "This is the Verbal Abuse Room, you heap of parrot droppings!"
    
     elif answer == "right" or answer == "r":
    
     print "Of course this is the Argument Room, I've told you that already!"
    
     else:
    
     print "You didn't pick left or right! Try again."

全部评论 (0)

还没有任何评论哟~