-
#2-1 简单消息
message = "Hello World!"
print(message) -
#2-2 多条简单消息
message = "Hello World!"
print(message)
message = ‘hello pyhton world’
print(message) -
#2-3 个性化消息
name = 'johnson'
print('hello' + name + ''would you like to learn some python today') -
#2-4 调整名字的大小写
name = 'johnson'
print(name.title())
print(name.upper())
print(name.lower) -
#2-5 名言
name = 'albert einstein'
print(name.title() + ' once said,' + '"A person who never made a mistake never tried anything new." ') -
#2-6 剔除人名中的空白
name = ' \njohnson\t'
print(name)
print(name.lstrip())
print(name.rstrip())
print(mame.strip()) -
#2-7 数字8
print(1+7)
print(2*4)
print(24/3)
print(16-8) -
#2-8 最喜欢的数字
favorite_number = 23
print('my favorite number is '+str(favorite_number)) -
# python之禅
import this
python从入门到实践作业 第二章
最新推荐文章于 2023-04-09 01:27:13 发布