摘要:
##while循环 message = "" while message != 'quit': message = input("Enter 'quit' to end the program: ") if message != 'quit': print(message) ##循环标志 activ 阅读全文
摘要:
字典是一系列键值对,每个键都与一个值相关联。 ##访问字典的值 alien = {'color':'green','points':5} new_points = alien['points'] print("You just earned " + str(new_points) + " point 阅读全文
摘要:
##检查相等和不等 ##多个检查条件 age1 = 22 age2 = 19 s1 = age1 > 21 and age2 > 19 print(s1) s2 = age1 > 21 or age2 > 19 print(s2) ##检查是否包含在列表内 requested_toppings = 阅读全文
摘要:
##遍历元素 magicians = ['alice','david','carolina'] for magician in magicians: print(magician) magicians = ['alice','david','carolina'] for magician in ma 阅读全文
摘要:
##列表索引 list = ['trek','cannondale','redline','specialized'] print(list[0].title()) ##列表方法 ###修改元素 list = ['trek','cannondale','redline','specialized'] 阅读全文