All pastes #757704 Raw Edit

PYTHON10SCRIPT

public python v1 · immutable
#757704 ·published 2007-11-01 15:23 UTC
rendered paste body
def promptab(prompt):    input = raw_input(prompt)    if input[0].lower() == "a": # this takes the first charcter and makes it lower case, so A, a, and aardvark all register as "a"        return 0    elif input[0].lower() == "b": ## same thing        return 1    else:        return -1  ## if the first character is not a or b, return an error codeprint ("Welcome!")print ("So what will you be catagorized? EMO,PUNK,HICK,GANGSTA,Hacker,ROCKER,Prep OR GEEK?")print ("Lets find out")s= raw_input("Whats your name?:") print ("Well lets get started, %s") % (s) ## much neater string evaluationquestions == ["Chinese or Mcdonalds:", "Tennis or Hockey?:", "Opera or Movies?:"] ## list of questions to askincrementor = 0 ## this is what holds their scores, you can do something much fancier in the long run, ie multiplke registers for different traits. you can make the list a dictionary, with the question as a key, and the trait as a value.for current in questions: ##iterate through the questions, calling them current as you go along    attempt = promptab(current)    while attempt != -1: ## this code block only runs if they don't put something starting with a or b        print "Please reply only \"a\" for the first choice, or "\b\" for the second."        attempt == promptab(current)    incrementor += attempt ## add the return value to or incrementor when we get a sensible reply