sys.exit 用于结束程序 2 from sys import exit 3 4 # 进入黄金房间后的逻辑 5 def gold_room(): 6 print("This room is full of gold. How much do you take?") 7 8 choice = input("> ") 9 # 如果输入不包含 0 或 1 则死 10 if "0" in choice or "1" in c
he string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIG
Exercise 32 代码 the_count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] # this first kind of for-loop goes through a list for number in the_count: print "This is count %d&q