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 _______
- 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
- 50
- 55
- 60
- What is the value of
st after the code below executes?
st = ""
for x in "python":
st = x + st
#value here
- python
- nohtyp
- ptyohn
- 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
- python
- nohtyp
- arrgh