第1-2章
这是B站UP主Master_lisa对书本进行讲解的视频链接
#2.1————运行hello world
print("Hello Python world!")
#2.2————变量
message = "Hello python world!"
print(message)
message = "Hello python world!"
print(message)
message = "Hello python Crash Course world!"
print(message)
message = "Hello"
print(messag)
#2.3.1————使用方法修改字符串的大小写
name = "ada lovelace"
print(name.title())#首字母大写
print(name.upper())#全部字母大写
name="ADA LOVELACE"
print(name.lower())#全部字母小写
#2.3.2————在字符串中使用变量
first_name = "ada"
last_name = "lovelace"
full_name = first_name + ""+ last_name
print(full_name)
#2.3.3————使用制表符或换行符来添加空白
print("Python")
print("\tPython")
print("Python")
print("\nPython")
print("Languages:\n\tPython\n\tC\n\tJavaScript")
#2.3.4————删除空白
favorite_language = ' python '
print(favorite_language.rstrip())
print(favorite_language.lstrip())
print(favorite_language.strip())
#2.3.5————使用字符串时避免语法错误
#message = 'One of Python's streangths is its diverse community.'
#print(message)
message = "One of Python's streangths is its diverse community."
print(message)
#2.4————数
x, y, z = 0, 1, 2
print(x,y,z)
#2.4.6常量一般用大写字母定义
MAX_CONNECTIONS=5000
print(MAX_CONNECTIONS)