In [1]:
s='segwpiehpijsdfoih'
n=len(s)
print(s[n::-1])


hiofdsjipheipwges

In [13]:
import math
def fun1():
    print('请输入直角三角形所占行数:')
    n=int(input('行数:'))
    for i in range(1,n+1):
        print('*'*i)

        
def fun2():
    print('请输入等腰三角形所占行数:')
    n=int(input('行数:'))
    for i in range(1,n+1):
        print(' '*(n-i)+'*'*i+'*'*(i-1))
   

fun1()
fun2()


请输入直角三角形所占行数:
行数:4
*
**
***
****
请输入等腰三角形所占行数:
行数:4
   *
  ***
 *****
*******

In [16]:
word=input('请输入一个英语单词:')
if word.endswith('s')or word.endswith('x') or word.endswith('sh') or word.endswith('ch') or word.endswith('o') or word.endswith('z'):
    print(word+'es')
elif word.endswith('by') or word.endswith('cy') or word.endswith('dy')or word.endswith('fy')or word.endswith('hy')or word.endswith('gy')or word.endswith('jy')or word.endswith('ky')or word.endswith('ly')or word.endswith('my')or word.endswith('ny')or word.endswith('py')or word.endswith('qy')or word.endswith('ry')or word.endswith('sy')or word.endswith('ty')or word.endswith('vy')or word.endswith('wy')or word.endswith('xy')or  word.endswith('yy')or word.endswith('zy'):
    print(word[:-1]+'ies')
elif word.endswith('f'):
    print(word[:-1]+'ves')
elif word.endswith('fe'):
    print(word[:-2]+'ves')
else:
    print(word+'s')


请输入一个英语单词:life
lives

In [ ]: