2017年5月15日
摘要: 5.1.1 函数input()的工作原理: 函数input()让程序暂停一会儿,等待用户输入一些文本。获取用户输入后,python将其存储在一个变量中,以方便使用 message = input('Tell me someing,and i will repeat it back to you:') 阅读全文
posted @ 2017-05-15 14:12 dayPy 阅读(167) 评论(0) 推荐(0)
摘要: alien_0 = {'color':'green','points':5}print(alien_0['color'])print(alien_0['points']) 字典格式 key:value格式 添加键值对: alien_0['x_postion'] = 0alien_0['y_posti 阅读全文
posted @ 2017-05-15 12:37 dayPy 阅读(117) 评论(0) 推荐(0)
摘要: 简单实例: cars = ['audi','bmw','subaru','toyata'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) 条件测试: car = 'bmw' car == ' 阅读全文
posted @ 2017-05-15 10:29 dayPy 阅读(208) 评论(0) 推荐(0)
摘要: 定义元祖: dimensions = (200,50)print (dimensions[0])print (dimensions[1]) 元祖中的元素无法被修改 遍历元祖中的值: for dimension in dimensions: 与列表一样可被遍历 print (dimension) 阅读全文
posted @ 2017-05-15 09:39 dayPy 阅读(146) 评论(0) 推荐(0)