《Python 编程:从入门到实践》第二章(数据类型)练习题答案

字符串知识点:
string.title()
string.rstrip()
string.lstrip()
string.strip()
字符串部分练习题答案:
name = ’ Ya Wei ’
message = (‘Hello %s,would you liake to learn some Python today?’ % name)
print(name.title())
print(name.lower())
print(name.upper())
print(name.strip())

数字知识点:
两个乘号()表示乘方:如: 106 = 1000000
string = str(int)
print(3*0.1)

数字部分练习题答案:
print(3+5)
print(10-2)
print(2**3)
print(16/2)

num = 5
print('my favorite num is '+ str(num) )

Python之禅:
代码编写指导原则

转 Python 字符串操作方法大全 https://www.cnblogs.com/printN/p/6924077.html

猜你喜欢

转载自blog.csdn.net/zenmehaichonga_2009/article/details/82770773