-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLec11.py
More file actions
27 lines (24 loc) · 634 Bytes
/
Copy pathLec11.py
File metadata and controls
27 lines (24 loc) · 634 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# MIT600《计算机科学及编程导论》(2008年秋季)样码
# 第十一讲
# 翻译制作:ocourse.org
# 课程讨论版:http://ocourse.org/bbs/forum.php?mod=forumdisplay&fid=29
# by yoeo24
def silly():
res = []
done = False
while not done:
elem = raw_input('Enter element. Return when done.')
if elem == '':
done = True
else:
res.append(elem)
print 'res',res
tmp = res[:]
print 'tmp',tmp,'res',res
tmp.reverse()
isPal = (res == tmp)
print 'tmp',tmp,'res',res
if isPal:
print 'is a palindrome'
else:
print 'is NOT a palindrome'