首页 > 其他分享 >0811day04

0811day04

时间:2024-08-11 16:15:54浏览次数:5  
标签:10 name weight height print 0811day04 my

  1. 使用格式化输出的三种方式实现以下输出(name换成自己的名字,既得修改身高体重,不要厚颜无耻)
name = 'Nick'
height = 180
weight = 140

# "My name is 'Nick', my height is 180, my weight is 140"
name = 'Nick'
height = 180
weight = 140
print(f"My name is {name}, my height is {height}, my weight is {weight}")
print("My name is %s, my height is %s, my weight is %s"%(name,height,weight))
print("My name is "+name+ "my height is" +str(height)+"my weight is "+str(weight))
print("My name is {}, my height is {}, my weight is {}".format(name,height,weight))

2.整理《基本运算符》博客,并给出url链接:

  1. 一行代码实现下述代码功能:
x = 10
y = 10
z = 10
print("x = {},y = {},z = {}".format(10,10,10))
  1. 两种方式交换x和y的值:
x = 10
y = 10

  1. 一行代码取出该列表的第2、3个爱好:nick_hobby_list = ['read','run','music','code']

nick_hobby_list = ['read','run','music','code']
,x,y, = nick_hobby_list
print(f'x:{x},y:{y}')

标签:10,name,weight,height,print,0811day04,my
From: https://www.cnblogs.com/brokenheart921/p/18353557

相关文章