这是我自己学习的答案,会尽力写的比较好。还望大家能够提出我的不足和错误,谢谢!
原文例题:
from sys import exit
from random import randint
def death():
quips = ["You died. You kiinda suck at this.",
"Nice job, you died ...jackass.",
"Such a luser.",
"I hace a small puppy that's better at this."]
print quips[randint(0, len(quips)-1)]
exit(1)
def central_corridor():
print "The Gothons of Planet Percal #25 have incaded your " \
"ship and destryed"
print "your entire crew. You are the last surviving " \
"member and your last"
print "mission is to get the neutron destruct bomb from" \
" the Weapons Aromory,"
print "put it in the bridge, and blow the ship up after" \
" getting into an "
print "Escape pod."
print "\n"
print "Yor're running down the central corridor to the" \
"Weapons Aromry when" \
"\n" \
"a Gothon jumps out, red scaly skin, dark grimy" \
" teeth, and wvil clown costume" \
"\n" \
"flowing around his hate filled boby. He's blocking " \
"the door to the" \
"\n" \
"Armory and about to pull a weapon to blast you."
action = raw_input("> ")
if action == "shoot!":
print "Quick on the draw you yank out your blaster and" \
"fire it at the Gothon." \
"\n" \
"His clown costume is flowing and moving around " \
"his body,which throws" \
"\n" \
"off your aim. Your laser hits his costume but " \
"misses him entirely. This" \
"\n" \
"completely ruins his brand new costume his mother" \
" bought him, which" \
"\n" \
"makes him fly into an insane rage and blast you" \
" repeately in the face until" \
"\n" \
"you are dea. Then he eats you."
return 'death'
elif action == "dodge!":
print "Like a world class boxer you dodge, weave, slip" \
"and slide right" \
"\n" \
"as the Gothon's blaster cranks a lase