实验任务1

 1 print('hey, u')
 2 
 3 
 4 print('hey','u')
 5 x,y,z=1,2,3
 6 print(x, y, z)
 7 
 8 
 9 print('x=%d, y=%d, z=%d'%(x,y,z))    
10 print('x = {}, y = {}, z = {}'.format(x,y,z))    
11 print(f'x = {x}, y = {y},z = {z}')    
12 
13 
14 print(x)     
15 print(y)
16 print(z)
17 
18 print(x, end=' ')      
19 print(y, end=' ')
20 print(z)
 1 x1, y1 = 1.2, 3.57
 2 x2, y2 = 2.26, 8.7
 3 
 4 print('{:-^40}'.format(''))
 5 print('x1 = {}, y1 = {}'.format(x1, y1))
 6 print('x2 = {}, y2 = {}'.format(x2, y2))
 7 
 8 print('{:-^40}'.format(''))
 9 print('x1 = {:.1f}, y1 = {:.1f}'.format(x1, y1))
10 print('x2 = {:.1f}, y2 = {:.1f}'.format(x2, y2))
11 
12 print('{:-^40}'.format(''))
13 print('x1 = {:<15.1f}, y1 = {:<15.1f}'.format(x1, y1))
14 print('x2 = {:<15.1f}, y2 = {:<15.1f}'.format(x2, y2))
15 
16 print('{:-^40}'.format(''))
17 print('x1 = {:>15.1f}, y1 = {:>15.1f}'.format(x1, y1))
18 print('x2 = {:>15.1f}, y2 = {:>15.1f}'.format(x2, y2))
1 name1, age1 = 'Bill', 19
2 name2, age2 = 'Hellen', 18
3 title = 'Personnel Information'
4 print(f'{title:=^40}')
5 print(f'name: {name1:10}, age: {age1:3}')
6 print(f'name: {name2:10}, age: {age2:3}')
7 print(40*'=')

 

posted @ 2022-03-23 17:15  张博睿  阅读(18)  评论(0编辑  收藏  举报