python_1st
只是记录下自己的学习过程printage = 27nname = 'Tzuyu'nweight = 75.5nstu_id = 216nnprint("I am %d years old&#3
只是记录下自己的学习过程
age = 27nname = 'Tzuyu'nweight = 75.5nstu_id = 216nnprint("I am %d years old" % age)nprint("My name is %s" % name)nprint("My weight is %.1f kg" % weight)nprint("My student ID is %06d" % stu_id)nprint("My name is %s, I am %d years old" %(name, age) )nprint("I will be %d next year" %(age+1))nnprint('My name is %s, my age is %d. I am %.1f kg, my student ID is %06d' % (name, age, weight, stu_id))nn"""n这一节错过的bug, ‘打印内容’和%注释数据类型之间没有 ,逗号 注意ab括号n"""
print extend
name = 'Tzuyu'nage = 27nweight = 75.5nn# My name is X, I am X years old, I am X kgnnprint(f'My name is {name} nI am {age} years old nI am {weight} kg')n# f 格式化字符串更高效率 是python3.6以后的新功能nn# n 换行 t制表符 4个空格nn#print结束符nprint('abcd', end="n")nprint('abcd', end="t")nprint('abcd', end="n")nprint('abcd', end="...")
下一篇:GBox-1