Compsci 101, Fall 2012, September 5
By entering your name/net-id below you indicate you are in class on
September 5 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 printed after the code below executes?
contactMail = ‘RushAdams At fire.com’
if contactMail.count(‘@’) == 1 :
print ‘Valid e-mail’
else:
print ‘E-mail must contain 1 @ character’
- Valid e-mail
- E-mail must contain 1 @ character
- None
- What is the value of res after the code below executes?
mark = ‘Rake up Door #2’
res = “”
res = mark[8] + mark[5]
res = mark[2:4]
res = mark[8] + mark[5] + res
res = res + mark[12:14] + ‘1’
#value here
- Duke #1
- DukeDuke #1
- DukeDuke #21
- What is the value of st after the code below executes?
st = ""
for x in "python":
st = x + st
#value here
- python
- nohtyp
- ptyohn