1.
s = input(">>>")
result = ' '.join([i.lower()[1:] + i[0].lower() +'ay' for i in s.split()])
print(result)
2.
s = input(">>>")
for i in s.split() :
if i[0] == 'b':
print(i)
3.
s = input(">>>")
for i in s.split() :
if i[-2:] == 'ed':
print(i)
4.
def getR(l):
return sorted(set(l))
s = input(">>>")
res = getR(list(map(int, s.split())))
print(res)
5.
s = input(">>>")
d = {'ABC': '2',
'DEF': '3',
'GHI': '4',
'JKL': '5',
'MNO': '6',
'PRS': '7',
'TUV': '8',
'WXY': '9',
}
res = [[v for k, v in d.items() if i in k] for i in s]
res = ''.join(i[0] for i in res)
print(res)
6.
def getR(s):
return s.lower() == s.lower()[::-1]
s = input(">>>")
print(getR(s))
用列表模拟栈
def is_palindrome(s):
s = s.lower()
l = []
for i in s:
l.append(i)
s1 = ''
while l:
s1 += l.pop()
return s == s1
s = input(">>>")
print(is_palindrome(s))
明天给写一下,到时发给你啊,先标记下
马上写完
现在都这么卷了吗?
就这样的情况,那么多大佬就来了。
看来生活都不好过啊。
看来不光是上班的难,学生也挺难的,哎,都是疫情闹得