learn python the hard way 习题1~5总结

习题1

print 语句
print('Yay! Printing.')
print('I "said" do not touch this')

习题2:注释和 # 号

#(octothorpe),用于注释一条语句,在 # 之后的内容全部被忽略。

习题3:数字和数字计算

当进行关系运算的时候,比如 3+2<5-7,那么返回的是一个 True 或者 False

习题4:变量和命名

设定变量之后,可以在以后的时候用到。

习题5:更多的变量和打印

print(f"{}")
f告诉python 后面的{}是一段格式化的输出,{}中可包含数字和字符串

原文地址:https://www.cnblogs.com/FBsharl/p/10127690.html