In [1]:
s = '北京语言大学'

def reverse(s) :
    x = len(s)
    sub_s = ''
    for i in range(x) :
        sub_s += s[i]
        
    for i in range(x-1 , -1 , -1) :
        print(sub_s[i],end = '')
        
reverse(s)


学大言语京北

In [21]:
rows = int(input('输入行数,以回车结束。 '))
i = 1
j = 1
k = 1

print("等腰直角三角形")
for i in range(0, rows):
    for k in range(0, rows+1 - j):
        print (" * "*(rows+1-j))
        k += 1
        j+=1
    i += 1
    print ("\n")


输入行数,以回车结束。 5
等腰直角三角形
 *  *  *  *  * 
 *  *  *  * 
 *  *  * 
 *  * 
 * 











In [25]:
def wordends(word) :
    if word.endswith('x') or word.endswith('ch') or word.endswith('s') or word.endswith('z') or word.endswith('sh'):
        print(word,'es',sep='')
    elif word.endswith('y') :
        print(word[:-1]+'ies')
    elif word.endswith('f') :
        print(word[:-1]+'ves')
    else:
        print(word,'s',sep='')
        
        
word = input('请输入一个单词:')
wordends(word)


请输入一个单词:fly
flies

In [ ]: