Compsci 06/101, Spring 2012, January 31

By entering your name/net-id below you indicate you are in class on January 31 to answer these questions and that you have answered them. Your name should not appear unless you are in class when answering these questions.
Name_________________   net-id _______   Name_________________   net-id _______


Name_________________   net-id _______   Name_________________   net-id _______

  1. What is the value of the variable total after the segment below executes?
        total = 0
        for x in range(10):
            total = total + x
    
        #value here
    

    1. 50

    2. 55

    3. 60

  2. What is the value of st after the code below executes?
        st = ""
        for x in "python":
           st = x + st
    
        #value here
    

    1. python

    2. nohtyp

    3. ptyohn

  3. What is the value of st after the code below executes?
        st = ""
        py = "python"
        for x in range(1,len(py)+1):
           st = st + py[-x]
    
        #value here
    

    1. python

    2. nohtyp

    3. arrgh