test2

x1, y1 = 1.2, 3.57
x2, y2 = 2.26, 8.7
print('{:-^40}'.format('输出1'))
print('x1 = {}, y1 = {}'.format(x1, y1))
print('x2 = {}, y2 = {}'.format(x2, y2))

print('{:-^40}'.format('输出2'))
print('x1 = {:.1f}, y1 = {:.1f}'.format(x1, y1))
print('x2 = {:.1f}, y2 = {:.1f}'.format(x2, y2))

print('{:-^40}'.format('输出3'))
print('x1 = {:<15}, y1 = {:<15}'.format(x1, y1))
print('x2 = {:<15}, y2 = {:<15}'.format(x2, y2))

test2

 

 

x=input("请输入一段英文:")
s=x.upper()
print(s.replace("A",""))

test2

 

 

name_list = ['david bowie', 'louis armstrong', 'leonard cohen', 'bob dylan', 'cocteau twins']
n = 1
for name in name_list:
print(f'{n}: {name.title()}')
n += 1

test2

 

 

 

name_list = ['david bowie', 'louis armstrong', 'leonard cohen', 'bob dylan', 'cocteau twins']
name_list=sorted(name_list)
n=1
for name in name_list:
print(f'{n}.{name.title()}')

test2

 

 

str1=input("请输入任意字符串")
list1=[]
list2=[]
for i in str1:
   if i.isdigit()==True:
      list2.append(int(i))
   else:
        list1.append(i.upper())
print(list2)
print(list1)

test2

 

 

i=1
list1=list()
while i !=4:
n= input ('输入想要加入愿望清单的事 :')
list1.append(n)
i=i+1
n=1
print('{:-^50}'.format('我的愿望清单'))
for x in list1:
print(f'{n}.{x}')
n=n+1

test2

 

上一篇:在C/C++程序中打印当前函数调用栈


下一篇:JavaScript优化技术