其他分享
首页 > 其他分享> > jinri

jinri

作者:互联网

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))

 

 


实验2
n=input()
x=n.upper()
print(x.replace('A',' '))

 
#实验3
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

 

 

 

def main():
    pass
if __name__ == '__main__':
    main()
names_list=['David bowie','Louis armstrong','Leonard cohen','Bob dylan',
'Cocteau twins']
n=1
for name in names_list:
    print(f'{n}. {name.title()}')
    n +=1

 

 实验6

wish1=input('请输入愿望1')
wish2=input('请输入愿望2')
wish3=input('请输入愿望3')



print('{:-^50}'.format('我的愿望清单'))
print('1.'+wish1)
print('2.'+wish2)
print('3.'+wish3)

 

 

 

 实验五

Zen=input('请输入python之禅')
print(len(Zen.splitlines()))
print(len(Zen.split()))
print(len(Zen))
print(Zen.count(' '))

 

 

 

标签:name,format,Zen,y1,jinri,print,x1
来源: https://www.cnblogs.com/yusuli/p/14611664.html