实验二

x1,y1=1.2,3.57
x2,y2=2.26,8.7

print('{:-^40}'.format('输出一'))

print('x1={},y1={}'.format(x1,y1))
print('x2={},y2={}'.format(x2,y2))

print('{:-^40}'.format('输出二'))
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))


a=input('请输入一段字符串')
b=str.upper(a)
c=b.replace('A','')
print(c)


name_list = ['ycq', 'dj', 'wyh', 'zfy',
'szf']
n = 1
for name in name_list:
    print(f'{n}: {name.title()}')
    n += 1


list = ['ycq', 'dj', 'wyh', 'zfy',
'szf']
name_list=sorted(list)
n=1
for name in name_list:
    print(f'{n}. {name.title()}')
    n += 1

file_name ="file.txt"

line_counts =0

word_counts =0

character_counts =0

with open(file_name, 'r')as f:

    for line in f:

        words = line.split()

        line_counts +=1

        word_counts +=len(words)

        character_counts +=len(line)

print ("line_counts ", line_counts)

print( "word_counts ", word_counts)

print ("character_counts ", character_counts)

name_list=[]
for i in range(3):
    x = input('输入想要加入愿望清单的事情')
    name_list.append(x)
print('{:-^40}'.format('我的愿望清单'))
n=1
for name in name_list:
    print(f'{n}. {name.title()}')
    n += 1

 

上一篇:实验1


下一篇:reg3, 多元回归, 面板数据, 方差分析, 异方差和自相关检验和修正的Stata程序Handbo