PyGame 指南/Python 速成课程
外观
一个简单的 Hello World 程序
print("Hello World")
Python 中的变量是动态类型的。这意味着一个变量可以保存数字、字符串或任何对象。
variably = 40
variably = 40.9
variably = "fourty point nine"
print(variably)
# Based on the assignment above, this will print "fourty point nine"
if True:
print("This will always execute")
if 6 > 5:
print("6 is, in fact, greater than 5")
variably = False
if variably:
print("variably is True")
else:
print("variably is False")
letter = "a"
if letter == "a":
print("got option A")
elif letter == "b":
print("got option B")
elif letter == "c":
print("got option C")
else:
print("got unknown option")